I have a binary number I need to print including the leading zeros. So far I do this with:
print("CRC -> {:08b}".format(crc)
But this crc could have different sizes. What I'd like to achieve is a print statement that instead of :08b would take individual length like
crc_len = (len(hex(crc))-2)*4
But how would my print then need to look, how can I do conditional formatting depending on crc_len?