Python int()
Python int() class
The int() class in Python returns an integer object constructed from a number or string x.
Syntax
class int(x, base=10)
Parameter
x: This parameter represents a number or a string that can be converted into an integer number
base: This parameter represents a number representing the number format. Its default value is 10.
Return
This class return an integer object constructed from a number or string x, or return 0 if no arguments are given.
Example 1
# Python program explaining # the int() class #converting string to int value str= "987" x= int(str) print(x)
Output
987