Python oct() Function
ExampleGet your own Python Server
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 |