简体   繁体   中英

Unescape the chinese characters in url?

Sometimes, Chinese characters are escaped into forms like:

%B9%F3%D6%DD%C3%A9%CC%A8

How do I convert these back to readable chinese characters in Python?

You can use urllib2.unquote like this:

>>> import urllib2
>>> print urllib2.unquote('%B9%F3%D6%DD%C3%A9%CC%A8').decode('gbk')
贵州茅台

尝试这个,

urllib.unquote(your_string).decode(your_encoding)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM