Language Syntax

Integer literal — Python syntax

Integer literals can use decimal, binary, octal or hexadecimal notation and permitted underscore separators. Nonzero decimal integers cannot have leading zeros. A sign is a separate unary operation; integers have arbitrary precision subject to resource limits.

Formal Syntax & Structure

python syntaxpython
123 | 0b101 | 0o17 | 0xff

Return Value

int

Value obtained by evaluating this expression; see description for context and constraints.

Working Example

Example Snippetpython
values=(0b101,0o17,0xff,1_000)print(values)
Python Reference