This is a pretty basic question but I cannot get the answer. I have a list l = [[1500.0]]
and I wish to convert it into l = [1500.0]
but I am unable to do so.
I've tried:
[float(x) for [x] in elements_in_l]
Thanks in advance!
This is a pretty basic question but I cannot get the answer. I have a list l = [[1500.0]]
and I wish to convert it into l = [1500.0]
but I am unable to do so.
I've tried:
[float(x) for [x] in elements_in_l]
Thanks in advance!
Use list comprehension:
lst = [item for sublist in l for item in sublist]