list string to list

PHOTO EMBED

Tue Jun 27 2023 14:26:23 GMT+0000 (Coordinated Universal Time)

Saved by @quaie #python

ini_list = "[1, 2, 3, 4, 5]"
 
# printing initialized string of list and its type
print("initial string", ini_list)
print(type(ini_list))
 
# Converting string to list
res = ini_list.strip('][').split(', ')
content_copyCOPY