Tutorialsteacher

Follow Us

Python - oct()

The octal() converts a decimal integer in octal representation with 0o prefix.

>>>oct(12)
'0o14'
>>>oct(10)
'0o12'
>>>oct(8)
'0o10'
>>>oct(-23)
'-0o27'