Python int() is a built-in method that returns an integer object from any number or string. The method accepts value and base as arguments and returns an integer value.
Syntax
int(value, base)
Parameters
A value parameter is a number or a string that can be converted into an integer number.
A base parameter is a number representing the number format. The default value is 10.
Example
data = "1921"
print(int(data))
Output
The int() function returns,
- The integer object from a given number or string treats the default base as 10.
- If there are no parameters, then it returns a 0.
- If the base has been given, it treats the string in the given base (0, 2, 8, 10, 16).
That’s it.