python2/python3 name对照

最近在看jecvay大神的零基础自学用Python 3开发网络爬虫,以前用过python 2,但是python 3有了不小的改动,所以从网上找到了python 2和python 3的name对照:

Python 2 name                                                                         Python 3 name

urllib2.urlopen()                                                                       urllib.request.urlopen()
urllib2.install_opener()                                                           urllib.request.install_opener()
urllib2.build_opener()                                                             urllib.request.build_opener()
urllib2.URLError                                                                       urllib.error.URLError
urllib2.HTTPError                                                                     urllib.error.HTTPError
urllib2.Request                                                                         urllib.request.Request
urllib2.OpenerDirector                                                             urllib.request.OpenerDirector
urllib2.BaseHandler                                                                 urllib.request.BaseHandler
urllib2.HTTPDefaultErrorHandler                                          urllib.request.HTTPDefaultErrorHandler
urllib2.HTTPRedirectHandler                                                 urllib.request.HTTPRedirectHandler
urllib2.HTTPCookieProcessor                                               urllib.request.HTTPCookieProcessor
urllib2.ProxyHandler                                                                 urllib.request.ProxyHandler
urllib2.HTTPPasswordMgr                                                      urllib.request.HTTPPasswordMgr
urllib2.HTTPPasswordMgrWithDefaultRealm                    urllib.request.HTTPPasswordMgrWithDefaultRealm
urllib2.AbstractBasicAuthHandler                                          urllib.request.AbstractBasicAuthHandler
urllib2.HTTPBasicAuthHandler                                              urllib.request.HTTPBasicAuthHandler
urllib2.ProxyBasicAuthHandler                                               urllib.request.ProxyBasicAuthHandler
urllib2.AbstractDigestAuthHandler                                        urllib.request.AbstractDigestAuthHandler
urllib2.HTTPDigestAuthHandler                                            urllib.request.HTTPDigestAuthHandler
urllib2.ProxyDigestAuthHandler                                             urllib.request.ProxyDigestAuthHandler
urllib2.HTTPHandler                                                                urllib.request.HTTPHandler
urllib2.HTTPSHandler                                                             urllib.request.HTTPSHandler
urllib2.FileHandler                                                                   urllib.request.FileHandler
urllib2.FTPHandler                                                                  urllib.request.FTPHandler
urllib2.CacheFTPHandler                                                      urllib.request.CacheFTPHandler
urllib2.UnknownHandler                                                        urllib.request.UnknownHandler
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值