美文网首页
python2 python3 urllib区别

python2 python3 urllib区别

作者: Cindy小隐 | 来源:发表于2018-06-07 17:20 被阅读0次

Py2.x:
Urllib库
Urllin2库

Py3.x:
Urllib库

变化:
在Pytho2.x中使用import urllib2——-对应的,在Python3.x中会使用import urllib.request,urllib.error。
在Pytho2.x中使用import urllib——-对应的,在Python3.x中会使用import urllib.request,urllib.error,urllib.parse。
在Pytho2.x中使用import urlparse——-对应的,在Python3.x中会使用import urllib.parse.urlparse。
在Pytho2.x中使用import urlopen——-对应的,在Python3.x中会使用import urllib.request.urlopen。
在Pytho2.x中使用import urlencode——-对应的,在Python3.x中会使用import urllib.parse.urlencode。
在Pytho2.x中使用import urllib.quote——-对应的,在Python3.x中会使用import urllib.request.quote。
在Pytho2.x中使用cookielib.CookieJar——-对应的,在Python3.x中会使用http.CookieJar。
在Pytho2.x中使用urllib2.Request——-对应的,在Python3.x中会使用urllib.request.Request。

相关文章

网友评论

      本文标题:python2 python3 urllib区别

      本文链接:https://www.haomeiwen.com/subject/npagsftx.html