Python3 中urllib的使用

Python3 的 urllib 有五个内容 error parse request response robotparser(urllib是一个包,收集几个模块来处理网址)
Python3 中urllib的使用_第1张图片

1.urllib.error 异常情况,exception类(urllib.error包含从 urllib.request发生的错误或异常 )
Python3 中urllib的使用_第2张图片
2.urllib.parse(urllib.parse解析url )
3.urllib.request(urllib.request打开和浏览url中内容 )
Python3 中urllib的使用_第3张图片
4.urllib.response
5.urllib.robotparser(urllib.robotparser解析 robots.txt文件)

为了今后使用方便,在此将每个包中包含的方法列举如下:
urllib.error: * ContentTooShortError; HTTPError; URLError*

urllib.parse: parseqs; parseqsl; quote; quotefrombytes; quote_plus; unquote unquoteplus; unquoteto_bytes; urldefrag; urlencode; urljoin; urlparse; urlsplit; urlunparse; urlunsplit

urllib.request: AbstractBasicAuthHandler; AbstractDigestAuthHandler; BaseHandler; CatheFTPHandler; FTPHandler; FancyURLopener; FileHandler; HTTPBasicAuthHandler; HTTPCookieProcessor; HTTPDefaultErrorHandler; HTTPDigestAuthHandler; HTTPErrorProcessorl; HTTPHandler; HTTPPasswordMgr; HTTPPasswordMgrWithDefaultRealm; HTTPRedirectHandler; HTTPSHandler; OpenerDirector; ProxyBasicAuthHandler; ProxyDigestAuthHandler; ProxyHandler; Request; URLopener; UnknowHandler; buildopener; getproxies; installopener; pathname2url; url2pathname; urlcleanup; urlopen; urlretrieve;

urllib.response: addbase; addclosehook; addinfo; addinfourl;

urllib.robotparser: RobotFileParser

引用:http://blog.csdn.net/test_soy/article/details/51569323

你可能感兴趣的:(Python3)