Python oct() Function

Example

Convert the number 15 to its octal value:

x = oct(15)

Running Instance

Definition and Usage

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

Octal strings in Python are prefixed with 0o.

Syntax

oct(int)

Parameter Value

Parameter Description
int Integer