Skip to content
Built-in Functions

int()

Convert a value to an integer.

int(value=0, base=10)

int() converts a whole-number value or suitable numeric text to an integer. When converting text in another number base, provide the base argument.

Parameters

NameDescription
valueA number or numeric string to convert. If omitted, it defaults to 0.
baseThe number base for a string value; it defaults to 10.

Returns

An integer.

Try it

Run it and change it
text = "12"
number = int(text)
print(number + 3)

Related entries