integer to binary 0-padded

Daniel Rentz daniel.rentz at gmx.de
Wed Jun 15 08:33:20 EDT 2011


Hi,

Am 15.06.2011 14:29, schrieb Olivier LEMAIRE:
> Hi there, I've been looking for 2 days for a way to convert integer
> to binary number 0-padded, nothing... I need to get numbers converted
> with a defined number of bits. For example on 8 bits 2 = 00000010

bin(2)[2:].zfill(8)


Regards
Daniel



More information about the Python-list mailing list