Next / Previous / Contents / TCC Help System / NM Tech homepage

20.4. bin(): Convert to binary

This function takes an integer argument and returns a string that represents that number in binary (base 2) starting with '0b'.

>>> 
bin(7)
'0b111'
>>> bin(257)
'0b100000001'