urllib 简介

(1) urllib 是 Python 内置的 HTTP 请求库,用来向服务器发送 HTTP 请求
(2) 在 Python2.x 中,有 urllib 和 urllib2 两个模块;在 Python3.x 中,urllib2 合并到了 urllib 中
(3) 在 Python2.x 中使用 import urllib, urllib2 ;在 Python3.x 中使用 import urllib
(4) 在 Python2.x 中使用 urllib2.urlopen ;在 Python3.x 中使用 urllib.request.urlopen
(5) 在 Python2.x 中使用 urllib2.Request ;在 Python3.x 中使用 urllib.request.Request
(6) 在 Python2.x 中使用 urllib.quote ;在 Python3.x 中使用 urllib.request.quote
(7) 在 Python2.x 中使用 cookielib.CookieJar ;在 Python3.x 中使用 http.CookieJar
(8) 在 Python2.x 中使用 urllib.urlencode ;在 Python3.x 中使用 urllib.parse.urlencode

 

 

 

 

 

    

posted @ 2019-03-14 16:10  孔雀东南飞  阅读(892)  评论(0编辑  收藏  举报