Python Print Unicode List

With the following code

lst = [u'\u5de5', u'\u5de5'] msg = repr(lst).decode('unicode-escape') print msg 

I got

 [u'工', u'工'] 

How to remove leading u so that msg content is:

 ['工', '工'] 
+6
source share
1 answer
 >>> import sys >>> lst = [u'\u5de5', u'\u5de5'] >>> msg = repr([x.encode(sys.stdout.encoding) for x in lst]).decode('string-escape') >>> print msg ['工', '工'] 
+10
source

All Articles