Published February 16, 2022
Python int() function
The int() method in Python returns the numeric integer equivalent of a specified expression. An integer can be returned from a given object using the Python int() method or converted from a specified base to decimal using the int().
Syntax
|
Int(string, base) |
Where:
String comprises of 0’s and 1’s
Base refers to the integer value which represents the base of the number
Example
|
x = '10000' |
Output
|
10000 with base 2 = 16 |