Python int() Function
ExampleGet your own Python Server
Convert the number 3.5 into an integer:
x =
int(3.5)
Try it Yourself »
Definition and Usage
The int()
function converts the specified
value into an integer number.
Syntax
int(value, base)
Parameter Values
Parameter | Description |
---|---|
value | A number or a string that can be converted into an integer number |
base | A number representing the number format. Default value: 10 |