freshnewpage freshnewpage - 1 year ago 118
Python Question

How to write a raw hex byte to stdout in Python 3?

How do you get Python 3 to output raw hexadecimal byte? I want to output the hex


If I use
, I get the ASCII '170'.

Answer Source

The solution was to first create a bytes object:

x = bytes.fromhex('AA')

And then output this to stdout using the buffered writer

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download