python2中一些模块到python3中名称的变化
2017-11-30 20:08
351 查看
Python2 | Python3 |
---|---|
urllib2.urlopen() | urllib.request.urlopen() |
urllib2.Request() | urllib.request.Request() |
htmllib.HTMLParser | html.parser.HTMLParse |
httplib | http.client |
python3将python2中的urllib2、urlparse、robotparser并入了urllib模块,并且修改了urllib模块,其中包含了5个子模块,每个子模块中的常用方法如下:
模块名 | 常用方法 |
---|---|
urllib.error | ContentTooShortError、URLError、HTTPError |
urllib.parse | urlparse、_splitparams、urlsplit、urlunparse、urlunsplit、urljoin、urldefrag、unquote_to_bytes、unquote、parse_qs、parse_qsl、unquote_plus、quote、quote_plus、quote_from_bytes、urlencode、to_bytes、unwrap、splittype、splithost、splituser、splitpasswd、splitport |
urllib.request | install_opener、urlretrieve、 urlcleanup、 request_host、 build_opener、 _parse_proxy、 parse_keqv_list、 parse_http_list、 _safe_gethostbyname、 ftperrors、 noheaders、 getproxies_environment、 proxy_bypass_environment、 _proxy_bypass_macosx_sysconf、 Request |
urllib.response | addbase、 addclosehook、 addinfo、 addinfourl |
urllib.robotparser | RobotFileParser |
相关文章推荐
- python一些模块的安装
- python中的shelve模块,可以提供一些简单的数据操作
- python 从2.x-3.x一些变化
- python管理网络设备的一些模块
- python hdfs 模块的一些使用笔记
- (转)【pyinotify 模块】Python监视文件变化
- Python中常用的一些模块
- python3.x与2.x的一些变化
- Python的socket模块源码中的一些实现要点分析
- python中csv模块的一些简单用法
- Python一些扩展模块
- python安装必备一些模块
- 转载 - Python里面关于 模块 和 包 和 __init__.py 的一些事
- Python标准库中一些模块
- python模块的一些小知识
- python一些模块
- Python使用random和tertools模块解一些经典概率问题
- python:binascii模块 一些进制知识
- Python图像处理库PIL的ImageOps模块介绍 -----> 一些基本的图像操作