> 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