Convert a String Float Numeral Into an Integer in Python

(Last Updated On: 17/02/2023)

Python Program to Convert a String Float Numeral Into an Integer

# Convert a string float numeral into an integer in Python

balance_str = "123.456"
balance_int = int(float(balance_str))
  
# print the type
print(type(balance_int))
  
# print the value
print(balance_int)

Output:

<class 'int'>
123

Leave a Reply

Your email address will not be published. Required fields are marked *