Python Program to Parse a String to a Float or Int (Parse string into float)

bookmark

balance_str = "1500.4"
balance_float = float(balance_str)

# print the type
print(type(balance_float))

# print the value
print(balance_float)

 

Output

<class 'float'>
1500.4