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

    

原文地址:https://www.cnblogs.com/pzk7788/p/10530973.html