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:<
Use the ast module.
Ex
import ast print(ast.literal_eval('[1.3, 2.3, 4.5]'))
Output:
[1.3, 2.3, 4.5]