python 字符编码转换

>>> a = u'\xb2\xe2\xca\xd4'
>>> b = a.encode('raw_unicode_escape')
>>> print b
测试
>>> c = a.encode('latin1')
>>> print c
测试
unicode.encode(text, encoding='utf-8')
decode('unicode-escape')
decode('unicode-escape').encode('utf-8')

https://www.cnblogs.com/zejin2008/p/6861800.html

原文地址:https://www.cnblogs.com/angdh/p/11822876.html