首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

002:Python爬虫Urllib库全面分析

Python中有一个功能强大,用于操作URL,并且在爬虫中经常使用的库、就是Urllib库。 (在python2的时候,有Urllib库,也有Urllib2库。Python3以后把Urllib2合并到了Urllib中) 合并后,模块中有很多的位置变动。我在这里先介绍一些常用的改动。 Python2: import urllib2 >>>>>Python3:import urllib.request,urllib.error Python2:import urllib >>>>>Python3:import urllib.request,urllib.error,urllib.parse Python2:import urlparse >>>>>Python3:import urllib.parse Python2:urllib2.urlopen >>>>>Python3:urllib.request.urlopen Python2:urllib.urlencode >>>>>Python3:urllib.request.urlencode Python2:urllib.quote >>>>>Python3:urllib.request.quote Python2:cookielib.CookieJar >>>>>Python3:http.CookieJar Python2:urllib.Request >>>>>Python3:urllib.request.Request 以上是Urllib中常用命令的一些变动。如果之前没有Urllib的基础也没关系,本文后面会详细介绍这些代码的具体应用,以及其实现的各种功能。

01
您找到你想要的搜索结果了吗?
是的
没有找到
领券