>>> '无' #gbk字符
'\xce\xde'
>>> str1 = '\xce\xde'
>>> str1.decode('gbk') # 解码gbk为 unicode
u'\u65e0'
>>> str1.decode('gbk').encode('utf-8') # 解码gbk为 unicode 编码unicode 为utf-8
'\xe6\x97\xa0'
>>> print str1.decode('gbk').encode('utf-8')
鏃
>>> '无' #gbk字符
'\xce\xde'
>>> str1 = '\xce\xde'
>>> str1.decode('gbk') # 解码gbk为 unicode
u'\u65e0'
>>> str1.decode('gbk').encode('utf-8') # 解码gbk为 unicode 编码unicode 为utf-8
'\xe6\x97\xa0'
>>> print str1.decode('gbk').encode('utf-8')
鏃
转载于:https://www.cnblogs.com/liujianzuo888/p/5042093.html