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 190 views
3 answers 292 views
1 answer 171 views
1 answer 163 views
163 views asked Jan 12, 2017 by avibootz
2 answers 153 views
2 answers 170 views
...