Reputation: 330
I have a column encodings in my sqllite database with datatype TEXT. For example, it is a str-type record: [-0.008732336573302746, 0.02287052385509014].
How to get float values from string list?
Upvotes: 0
Views: 53
Reputation:
Use python’s built-in eval() to convert the string to python expression:
list_of_floats = eval(“[-0.34354989003, 1.4838348]”)
Upvotes: 0
Reputation: 7242
Just do:
my_list = eval("[-0.008732336573302746, 0.02287052385509014]")
Upvotes: 1