pyton list like string to list code example
Example 1: string list into list pandas
import ast
# initializing string representation of a list
ini_list = "[1, 2, 3, 4, 5]"
# Converting string to list
res = ast.literal_eval(ini_list)
# printing final result and its type
print ("final list", res)
print (type(res))
Example 2: string to list python
s = 'hello'
l = list(s)
print(l) # prints ['h', 'e', 'l', 'l', 'o']