I have a string like
"['foo', 'bar', 'baz', 0, 1]"
and want to convert this into a list like
['foo', 'bar', 'baz', 0, 1]
I have tried various methods of slicing the string into a list, but while that does work, it is keeping 0
and 1
as strings, while also being unable to change easily for different lists.
Is there an easier way, aside from massive for
loops and slicing?