Home > Software design >  Why is 5D in hex represented as bytearray(b']')?
Why is 5D in hex represented as bytearray(b']')?

Time:12-03

For example if you represent 5D in a bytearray you get bytearray(b']'), but I don't understand why.

Is it because of ASCII and if so, how is Python handling all the ASCII Characters?

CodePudding user response:

Under the hood it's all binary, right?

5d in hex is just 01011101 in binary. Turns out that ] in ascii is the same in binary 01011101. So really you just have 01011101 or in base10 93 represented in Hex and Ascii.

  • Related