How to convert all of the items in a list of float strings to floats with Python

1 Answer

0 votes
lst = ['4.53', '3.14', '1.24', '4.52', '2.98'] 
  
lst = [float(i) for i in lst]
  
print(lst) 


 
'''
run:

[4.53, 3.14, 1.24, 4.52, 2.98]
 
'''

 



answered Dec 20, 2019 by avibootz

Related questions

2 answers 223 views
1 answer 134 views
4 answers 263 views
2 answers 131 views
1 answer 166 views
...