How to convert an integer to a octal string in Python?

PythonServer Side ProgrammingProgramming

We have use oct() function from Python’s library to convert any integer to its octal equivalent number. We get a string having octal representation

>>> oct(100)
'0o144'
>>> oct(0x10)
'0o20'
>>> oct(10)
'0o12'


raja
Published on 08-Feb-2018 19:04:00
Advertisements