📅  最后修改于: 2022-03-11 14:45:46.219000             🧑  作者: Mango
# if you have list in string format and you want to convert it back into list type
# then you can use eval() function, for eg:
str_lst = "[code, in, python]"
lst = eval(str_lst)
output: [code, in, python]
# if you will try to use list() function, it won't help.
# It will separate all element and make it all string
list(str_list)
output:
['[', 'c', 'o', 'd', 'e', ',', ' ', 'i', 'n', ',', ' ', 'p', 'y', 't', 'h', 'o', 'n', ']']