Starting with Python 2.6 you can express binary literals using the prefix 0b or 0B:
>>> 0b101111
47
You can also use the new bin function to get the binary representation of a number:
>>> bin(173)
'0b10101101'
Another way:-
>>> print int('01010101111',2)
687
>>> print int('11111111',2)
255