Feb-23-2021, 08:31 AM
It's not a single byte, it's a bytes object which can hold several bytes. When printed, if the byte is in the ASCII range, it shows the ASCII character. If the byte is not in ASCII, it shows the value with 2 hexadecimal digits. Your object has 4 bytes inside. As an example, to break down your string into the component bytes in character, decimal, and hex form:
12 41 59 35 => 306272565
35 59 41 12 => 895041810
>>> for byte in b'\x12AY5': ... print(f"{repr(chr(byte)):>6s} - {byte} - {byte:x}") ... '\x12' - 18 - 12 'A' - 65 - 41 'Y' - 89 - 59 '5' - 53 - 35As it's not a single byte, you have a choice of what order if you want to assemble it into a single 32-bit decimal.
12 41 59 35 => 306272565
35 59 41 12 => 895041810