by oconnor663 · 7y ago · 0 comments
binary = bin(decimal)[2:]
That's because while `bin(0xff)` is indeed "0b11111111", `bin(0x00)` is "0b0". Python omits your leading zeros.A smaller nit, these lines:
hexadecimal = binascii.hexlify(byte)
decimal = int(hexadecimal, 16)
can be just decimal = byte[0]