I have a list of lists:
a = [['0.06'], ['0.54'], ['0.61']]
I want to convert this list into normal list like this:
a = [0.06, 0.54, 0.61]
How can I do it it
Using a list comprehension:
>>> a = [['0.06'], ['0.54'], ['0.61']]
>>> [float(x) for [x] in a]
[0.06, 0.54, 0.61]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With