oct()
Built-in FunctionPython 2.0+Intermediate
Converts an integer to an octal string prefixed with '0o'
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
Learn by Difficulty
Quick Example
python
print(oct(8)) print(oct(255)) print(oct(-42))
oct() is a built-in function that converts an integer to an octal string prefixed with '0o'.
Try in PlaygroundTags
builtinfunctioncore