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

bookmark

balance_str = "1500"
balance_int = int(balance_str)

# print the type
print(type(balance_int))

# print the value
print(balance_int)

 

Output

<class 'int'>
1500