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'

Learn Python using coding questions with answers.

Python Questions & Answers

Want to check how much you know Python?

Start Python Skill Test