How to convert base 10 to base 2?

Miki Tebeka miki.tebeka at gmail.com
Tue Aug 21 12:23:00 EDT 2012


> You get the binary by doing bin(x), where x is an integer.
Note that Python also support binary number literals (prefixed with 0b):
In [1]: 0b101
Out[1]: 5



More information about the Python-list mailing list