Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有时,汉字会转义为以下形式:
%B9%F3%D6%DD%C3%A9%CC%A8
如何在 Python 中将这些转换回可读的中文字符?
你可以urllib2.unquote这样使用:
urllib2.unquote
>>> import urllib2 >>> print urllib2.unquote('%B9%F3%D6%DD%C3%A9%CC%A8').decode('gbk') 贵州茅台
试试这个,
urllib.unquote(your_string).decode(your_encoding)