EN
Python - parse string to float
0 points
In this article, we would like to show you how to parse the string to float in Python.
Quick solution:
xxxxxxxxxx
1
text = "10.99"
2
print(float(text)) # 10.99
In this example, we present how to parse the string to a float.
xxxxxxxxxx
1
text1 = "10"
2
text2 = "10.99"
3
4
print(float(text1)) # 10.0
5
print(float(text2)) # 10.99
Output:
xxxxxxxxxx
1
10.0
2
10.99