Python oct() Function

❮ Built-in Functions


Example

Convert the number 12 into an octal value:

x = oct(12)
Try it Yourself »

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

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.