How do you get Python 3 to output raw hexadecimal byte? I want to output the hex 0xAA.
0xAA
If I use print(0xAA), I get the ASCII \'170\'.
print(0xAA)
The solution was to first create a bytes object:
bytes
x = bytes.fromhex('AA')
And then output this to stdout using the buffered writer
stdout
sys.stdout.buffer.write(x)