Convert from hex character to Unicode character in python
print u'\xd3'
Is all you have to do. You just need to somehow tell Python it's a unicode literal; the leading u
does that. It will even work for multiple characters.
If you aren't talking about a literal, but a variable:
codepoints = '\xd3\xd3'
print codepoints.decode("latin-1")
Edit: Specifying a specific encoding when print
ing will not work if it's incompatible with your terminal encoding, so just let print
do encode(sys.stdout.encoding)
automatically. Thanks @ThomasK.