I wanted to convert an object of type bytes to binary representation in python 3.x.
For example, I want to convert the bytes object b'\x11'
to the binary representation 00010001
in binary (or 17 in decimal).
I tried this:
print(struct.unpack("h","\x11"))
But I'm getting:
error struct.error: unpack requires a bytes object of length 2