-1

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!

M_Arora
  • 113
  • 9

1 Answers1

1

Use list comprehension:

lst = [item for sublist in l for item in sublist]
Timur Shtatland
  • 12,024
  • 2
  • 30
  • 47