urllib库在python2和python3环境下的使用区别

好东西啊!!!

Python 2 name Python 3 name
urllib.urlretrieve() urllib.request.urlretrieve()
urllib.urlcleanup() urllib.request.urlcleanup()
urllib.quote() urllib.parse.quote() 
urllib.quote_plus() urllib.parse.quote_plus()
urllib.unquote() urllib.parse.unquote()
urllib.unquote_plus() urllib.parse.unquote_plus()
urllib.urlencode() urllib.parse.urlencode()
urllib.pathname2url() urllib.request.pathname2url()
urllib.url2pathname() urllib.request.url2pathname()
urllib.getproxies() urllib.request.getproxies()
urllib.URLopener urllib.request.URLopener 
urllib.FancyURLopener urllib.request.FancyURLopener
urllib.ContentTooShortError urllib.error.ContentTooShortError
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

原文:https://blog.csdn.net/whatday/article/details/54710403

原文地址:https://www.cnblogs.com/zhangtianyuan/p/9473497.html

时间: 2024-07-30 21:04:00

urllib库在python2和python3环境下的使用区别的相关文章

python2和python3的输入和输出区别

python2和python3的输入和输出区别: 1.  python2的输入: 1.1 raw_input()获取用户的原始输入: 1.2 input()会把用户输入的内容当做代码来执行: 2. python2的输出: python2中输出可以使用空格或者小括号: 3. python3的输入: python3版本中,没有raw_input()函数,只有input(),并且 python3中的input与python2中的raw_input()功能一样. 4 python3的输出: python

MAC OS上切换python2与python3环境

问题背景 在MAC Book Pro上进行python编程时,由于安装了python2和python3的环境,需要在不同的工程使用不同的python环境,这就需要在两个环境间切换. 系统配置 Mac OS Yosemite 10.10.3 (14D136) python2.7.9 python3.4.3 解决方案 安装Homebrew 使用Homebrew安装python2和python3 安装virtualenv 使用virtualenv创建虚拟环境 激活虚拟环境 安装Homebrew htt

ubuntu16.04下python2、python3环境选择与python升级

参考链接:https://www.jianshu.com/p/63c1f22e1fed Ubuntu中python版本问题: 添加PPA: sudo add-apt-repository ppa:jonathonf/python-3.6 查看更新和安装更新: sudo apt-get update sudo apt-get install python3.6 更换命令行中的python默认版本 sudo update-alternatives --install /usr/bin/python

如何在同一台电脑(windows系统)上同时搭建python2和python3环境

我们都知道python现在主要使用的有2个版本2.x和3.x,而这2个版本的语法却有很多的不同,python3.x并不是向下兼容2.x的.虽然说3.x是未来python的主流,但是很多工具和个人还是倾向于python2.x.所以在同一台电脑上安装2个python版本就很有必要了. 1.首先到python官网(https://www.python.org/downloads/)下载2个版本的安装包. 2.安装包都下载完成后,双击开始安装,全部默认即可. 3.安装完成后复制安装的路径,python2

CentOS 7安装Python3.6过程(让linux系统共存Python2和Python3环境)

CentOS 7系统自带了python2,不过可以不用2版本,直接使用python3运行python脚本就可以,但是千万别去动系统自带的python2,因为有程序依赖目前的python2环境,比如yum,动了yum就无法运行了,其他有的程序也可能会受影响.明白了上面的,然后就来安装Python3.6: 安装步骤: 1. 安装依赖环境 # yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel r

uwsgi flask 在python3环境下配置

常规用flask搭建个网页,用官方docker上的ubuntu16.04为基础镜像搭建,我用python3运行的flask,发现uwsgi --http-socket :80 --uwsgi-file test.py --callable app 发现无法运行,报getopt_long() error错误,根据google搜索解决方法 ,说要几个--python选项,于是uwsgi --http-socket :80 --uwsgi-file test.py --callable app  --

Python2.7.6环境下安装pip

由于在Python2.7.6下安装pip几次出错,为了后续安装不在出错现在梳理一下安装步骤: 1.安装Python2.7.6 # yum -y install gcc openssl openssl-devel # tar zxvf Python-2.7.6.tgz # cd Python-2.7.6 # ./configure # make install # mv /usr/bin/python /usr/bin/python.bak # ln -s /usr/local/bin/pytho

解决python3环境下twisted安装问题

twisted的安装经常会出问题,提示: 1.twisted错误,报Unable to find vcvarsall.bat2.等 解决办法: 1.安装wheel,命令:pip install wheel,用于安装编译.whl文件 或者将whl文件后缀修改为zip,然后解压,将解压的结果直接放置到第三方库的文件夹即可2.下载对应版本的twisted,34.35.36对应的Python版本下载地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

python2和python3中的关键字的区别--keyword模块

一.python3.6中的: 共33个关键字: 通过导入keyword模块,查看python所有的关键字.在ipython中: Python 3.6.0 |Anaconda 4.3.1 (64-bit)| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)]Type "copyright", "credits" or "license" for more information.