THE WORLD'S LARGEST WEB DEVELOPER SITE

Python oct() Function

❮ Built-in Functions


Example

Convert the number 12 into an octal value:

x = oct(12)
Run example »

Definition and Usage

The oct() function converts an integer into an octal string.

Octal strings in Python are prefixed with 0o.


Syntax

oct(int)

Parameter Values

Parameter Description
int An Integer Number

❮ Built-in Functions