sun1991
2016-11-19 16:49:34 +08:00
以下是我在 py2 上的测试结果, 你用的是 py3?
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ss = '%E6%88%91%E4%BB%AC%E5%A4%A7%E5%AE%B6'
>>> import urllib
>>> s = urllib.unquote(ss)
>>> s
'\xe6\x88\x91\xe4\xbb\xac\xe5\xa4\xa7\xe5\xae\xb6'
>>> s.decode('utf8')
u'\u6211\u4eec\u5927\u5bb6'
>>> print(s.decode('utf8'))
我们大家
>>> type(s)
<type 'str'>
>>>