python 2.7中urllib 2 与python 3.5中 urllib的区别。

python 3.x中urllib库和urilib2库合并成了urllib库。

其中urllib2.urlopen()变成了urllib.request.urlopen()

       urllib2.Request()变成了urllib.request.Request()

Python3 如何对url解码?实现Python2中urllib.unquote的作用?

Python2中,对url解码  可以这样做:
>>> print urllib.unquote("%E6%B5%8B%E8%AF%95abc")

 

 

python3取消unquote属性

可以这样做:

import urllib.parse

print(urllib.parse.unquote("%E6%B5%8B%E8%AF%95abc"))

 

 

posted @ 2016-10-19 10:51  bevis-blog  阅读(4545)  评论(0编辑  收藏  举报