Answers for "convert string to a float"

19

string to float python

# Use the function float() to turn a string into a float
string = '123.456'
number = float(string)
number
# Output:
# 123.456
Posted by: Guest on February-18-2020
0

convert mixed number string to float

>>> for x in ['1', '1/2', '1 2/3']: print(repr(parse(x)))
... 
1.0
0.5
1.6666666666666665
Posted by: Guest on November-15-2021

Code answers related to "convert string to a float"

Python Answers by Framework

Browse Popular Code Answers by Language