Converting a number to binary with a fixed length September 4, 2023 by Tarik No you don’t. >>> '{0:07b}'.format(12) '0001100'