"\xd0"
is an str
object, which in Python 3 is a Unicode string (= a sequence of Unicode code points) containing the Unicode code point U+00D0 (i.e. 208 i.e. Ð); when writing it with print
, Python has to convert it from Unicode (str
) to bytes (bytes
), so it has to use an encoding (an "abstract codepoints" to bytes converter).
In your case, as often, it happens to be UTF-8, where codepoint U+00D0 is encoded as the code-units (= bytes) sequence c3 90.
If you want to output literally a byte 0xd0, you have to use a byte string and go straight to the bytes stream that is beyond sys.stdout
:
import sys
sys.stdout.buffer.write(b'\xd0')