a=0100; print a ; 64 how to reverse this?

mosi skawanagi at gmail.com
Tue Jul 17 07:09:35 EDT 2007


Problem:
how to get binary from integer and vice versa?
The simplest way I know is:
a = 0100
a
64

but:
a = 100 (I want binary number)
does not work that way.

a.__hex__   exists
a.__oct__ exists

but where is a.__bin__ ???


What`s the simplest way to do this?
Thank you very much.




More information about the Python-list mailing list