-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
  • 111
  • 7

1 Answers1

0

Use list comprehension:

lst = [item for sublist in l for item in sublist]
Timur Shtatland
  • 9,559
  • 2
  • 24
  • 32