Print LIST of unicode chars without escape characters

后端 未结 5 901
南方客
南方客 2020-11-27 07:39

If you have a string as below, with unicode chars, you can print it, and get the unescaped version:

>>> s = \"äåö\"
>>> s
\'\\xc3\\xa4\\xc3         


        
5条回答
  •  情书的邮戳
    2020-11-27 08:12

    Another solution

    s = ['äåö', 'äå']
    encodedlist=', '.join(map(unicode, s))
    print(u'[{}]'.format(encodedlist).encode('UTF-8'))
    

    gives [äåö, äå]

提交回复
热议问题