Reputation: 63
I have issues with displaying Unicode characters. As an output I have this list (only on online IDEs):
[u'\u0413', u'\0434', u'\043b']
How can I convert this sequence to normally visible text?
I have
# -*- coding: utf-8 -*-
in header and also each string marked as Unicode like u'String'
I tried to use code:
myList = repr([x.encode(sys.stdout.encoding) for x in lst]).decode('string-escape')
but it's not working and output still the same.
Upvotes: 1
Views: 273
Reputation: 76867
In Python 3, this will work directly:
>>> [u'\u0413', u'\0434', u'\043b']
['Г', '#4', '#b']
In Python 2, you can use the print statement to print individual values:
>>> for val in [u'\u0413', u'\0434', u'\043b']:
... print val
...
Г
#4
#b
Upvotes: 2