Python进行URL解码

Python进行URL解码

所用模块:urllib

所用函数:urllib.unquote()

1
2
3
4
import urllib
rawurl = "%E8%A7%A3%E7%A0%81"
url = urllib.unquote(rawurl)
print url

输出:

1
解码

与上述函数对应的是编码函数:urllib.quote()

1
2
import urllib
urllib.quote("解码")

输出:

1
%E8%A7%A3%E7%A0%81

Comments

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×