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

bookmark

balance_str = "1500.34"
balance_int = int(float(balance_str))

# print the type
print(type(balance_int))

# print the value
print(balance_int)

 

Output

<class 'int'>
1500