Source Code:
(back to article)
import ast string_representation = "[1, 2, 3, 4, 5]" list_from_string = ast.literal_eval(string_representation) print(list_from_string) # Output: [1, 2, 3, 4, 5]
Result:
Report an issue