For data storage purposes I am trying to recover lists of floats from a .txt file. From the string like:
a = \'[1.3, 2.3, 4.5]\'
I want to recover:<
You can also use a more manual way:
[eval(x) for x in '[1.3, 2.3, 4.5]'.strip("[").strip("]").split(",")] Out[64]: [1.3, 2.3, 4.5]