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 187 views
3 answers 286 views
1 answer 167 views
1 answer 162 views
162 views asked Jan 12, 2017 by avibootz
2 answers 149 views
2 answers 166 views
...