u'\uNNNN'
is the ASCII-safe version of the string literal u'з'
:
>>> print u'\u0437'
з
However this will only display right for you if your console supports the character you are trying to print. Trying the above on the console on a Western European Windows install fails:
>>> print u'\u0437'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u0437' in position 0: character maps to <undefined>
Because getting the Windows console to output Unicode is tricky, Python 2's repr
function always opts for the ASCII-safe literal version.
Your print
statement is outputting the repr
version and not printing characters directly because you've got them inside a list of characters instead of a string. If you did print
on each of the members of the list, you'd get the characters output directly and not represented as u'...'
string literals.