方法是自己遇到后尝试能解决的,并不一定是最好的,纯当抛砖引玉啦
txt = '°æȨËùÓÐ 2013 ¶«ÄÏ´óѧÍøÂçÓëÐÅÏ¢ÖÐÐÄ'
print(txt.encode('latin1').decode('gbk'))
版权所有 2013 东南大学网络与信息中心
s='\xe5\x90\x89\xe6\x9e\x97\xe6\x95\x96\xe4\xb8\x9c\xe5\x8c\xbb\xe8\x8d\xaf\xe7\xa7\x91\xe6\x8a\x80\xe6\x9c\x89\xe9\x99\x90\xe5\x85\xac\xe5\x8f\xb8'
ss = s.encode('raw_unicode_escape').decode()
print(ss)吉林敖东医药科技有限公司
import urllib.parse
cc ="%CB%D1%CB%F7%B9%A4%B3%CC"
print(urllib.parse.unquote(cc,encoding='GB18030'))
搜索工程
解决'\u'开头的字符串转中文的方法
python3的解决办法:
字符串.encode('utf-8').decode('unicode_escape') 或者 encode('utf-8').decode('utf-8')
python2的解决办法:
字符串.decode('unicode_escape')
出现:illegal multibyte sequence 时
context.encode('latin1').decode('gbk', 'ignore')