python eval函数,将列表样式的字符串转化为列表

>>> str_1 = '[1,2,3,4,5,6]'
>>> type(str_1)
<type 'str'>
>>> list_1 = eval(str_1)
>>> list_1
[1, 2, 3, 4, 5, 6]
>>> type(list_1)
<type 'list'>
>>>

相关文章:

  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2021-10-14
  • 2021-07-04
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案