How to parse (convert) float in string to a float in Python

2 Answers

0 votes
n = "3.14"
f = float(n)

print(f)



'''
run:

3.14

'''

 



answered May 27, 2019 by avibootz
0 votes
n = "23"
f = float(n)

print(f)



'''
run:

23.0

'''

 



answered May 27, 2019 by avibootz

Related questions

1 answer 268 views
3 answers 461 views
1 answer 269 views
1 answer 243 views
243 views asked Jan 12, 2017 by avibootz
2 answers 271 views
2 answers 284 views
...