On this page
  1. oct
  2. Import & Availability
  3. Overview & Signature
  4. Usage
  5. Gotchas
  6. REPL Inspect

oct

Prev: object | Up: __builtins__ | Next: open
Rel: ascii, bin, chr, format, hex
Ref: docs.python.org — oct
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import oct

Overview & Signature

oct(number, /)

Return the octal representation of an integer.

Usage

assert oct(0o755) == "0o755"
assert f"{0o755:o}" == "755"

Gotchas

REPL Inspect

help(oct)

Linked from

Related notes