How to convert float value to a list with digits in Python

1 Answer

0 votes
f = 3.14159
  
lst = [int(d) for d in str(f) if d.isdigit()] 
      
print(lst) 


 
'''
run:
 
[3, 1, 4, 1, 5, 9]
 
'''

 



answered Dec 20, 2019 by avibootz

Related questions

...