Converting a number to binary with a fixed length

No you don’t.

>>> '{0:07b}'.format(12)
'0001100'

Leave a Comment