Collect from 网页模板

python3 乱码的一些处理方法

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')

发表评论

评论列表,共 3 条评论

  • DJEdwardNog
    Best Electronic Music for DJs http://0daymusic.org/premium.php SOME DETAILS ON PREMIUM ACCOUNT: * Music clips sorted 2000-2017 * Server's capacity: 126 TB MP3, Music Videos. * IP restrictions: 3 IP addresses per user at the same time. * Overal server's speed: 1 Gb/s. * More 11 years of scene archives 1990-2019. * Easy to use: Most of genres are sorted by days. Reseller: Premium Plan T - 20GB - 2 Days Premium Plan A - 300GB - 30 Days Premium Plan B - 900GB - 90 Days Premium Plan C - 2500GB - 180 Days Regards, 0DAY Music
  • Josephpaymn
    Bounce rate. Network traffic to boost ranks and exposure. NEW! Now you can choose the Country you want the traffic to come from, as well. Supercharge Your SEO And Boost Your Alexa Ranking with 1 Million unique Visitors Traffic sent Within 1 Month. Available only Here. Cheapest Offer On the Internet And Exclusively Available on Monkey Digital Read More details about our great offer: https://monkeydigital.co/product/network-traffic-offer/ Thanks and regards Mike Monkey Digital monkeydigital.co@gmail.com
  • EdwardMub
    WE ARE INTERESTED IN PARTNERSHIP WITH YOUR ESTIMINE COMPANY. KINDLY SEND US YOUR BUSINESS TERMS SO WE CAN PROCEED WITH OUR BUSINESS CONTRACT. WAITING FOR YOUR REPLY CONTACT E-MAIL: joyce@cercoon.com REGARD, JOYCE PAGE (sales Manager ) CARCOON STORAGE SYSTEMS INT Ltd. CONTACT E-MAIL: joyce@cercoon.com Address: Orchard Mill, 2 Orchard St S, Salford M6 6FL, UK