2.python爬虫基础——Urllib库
#python中Urllib库实战 #系统学习urllib模块,从urllib基础开始。学习urlretrieve(),urlcleanup(),info(),getcode(),geturl() import urllib.request #urlretrieve() 直接将一个网页爬到本地 urllib.request.urlretrieve("http://www.hellobi.com",filename="/Users/xubin/myapp/pythonfile/urlretrieve.html") #urlcleanup() 将urlretrieve产生的缓存,清空 urllib.request.urlcleanup() #info() 将一些基础的环境信息展示粗来 file=urllib.request.urlopen("http://www.hellobi.com") print(file.info()) #getcode() 获取访问url的状态码,返货200, print(file.getcode()) #geturl() 获取爬取得网址 print(file.g...