O'Reilly logo
  • Eihab Hala thinks this is interesting:

Python prints integer values in decimal (base 10) by default but provides built-in functions that allow you to convert integers to other bases’ digit strings, in Python-literal form—useful when programs or users expect to see values in a given base:

>>> oct(64), hex(64), bin(64)               # Numbers=>digit strings
('0o100', '0x40', '0b1000000')


Cover of Learning Python, 5th Edition


Octal, Hex and Bin