Как восстановить список из строки в Python

# 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', ']']
Darkstar