How to convert a number to binary?

Lyosha lyoshaM at gmail.com
Thu May 17 19:33:52 EDT 2007


Converting binary to base 10 is easy:
>>> int('11111111', 2)
255

Converting base 10 number to hex or octal is easy:
>>> oct(100)
'0144'
>>> hex(100)
'0x64'

Is there an *easy* way to convert a number to binary?




More information about the Python-list mailing list