Rob Rob - 10 days ago 7
Python Question

calling an index in bytes

I'm experimenting with bytes in python 3 and I'm getting a strange result. When I convert a character to hex I get a predictable result.

ord('t') == 116
, which is equal to 7*16 + 4. This is reasonable since:

binascii.hexlify(b't') == b'74'


What I don't understand is why
b'74'[0] == 55
. Where is the 55 coming from?

Answer

b'74'[0] is '7'. Character '7' is 55 in ASCII