Python Func Int
# Python2.x Python int() Function
[ Python Built-in Functions](#)
* * *
## Description
The `int()` function is used to convert a string or a number to an integer.
### Syntax
Here is the syntax for the `int()` method:
class int(x, base=10)
### Parameters
* x -- A string or a number.
* base -- The base of the number system, default is 10.
### Return Value
Returns an integer data type.
* * *
## Examples
The following examples demonstrate the use of the `int()` method:
>>>int()# When no argument is passed, the result is 0 0>>>int(3)3>>>int(3.6)3>>>int('12',16)# If the base parameter is provided, 12 must be input as a string. 12 in base 16 is 18>>>int('0xa',16)10>>>int('10',8)8
[ Python Built-in Functions](#)
YouTip