python3 将一个字符串形式的列表转换成List列表

it2024-04-02  65

#coding=utf-8 # string类型的列表 old_str = "[1,2,3,4]" # 转换 new_str = eval(old_str) print(new_str) print(type(new_str)) ############ [1,2,3,4] <class 'list'>

 

最新回复(0)