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

posted @ 2019-11-08 19:35  AngDH  阅读(337)  评论(0编辑  收藏  举报