urlretrieve(“网页地址”,“本地地址”) 把网页上的信息直接保存到本地

urllib.request.urlretrieve("http://www.baidu.com","D:\\mypython\\download")

 

urlcleanup() 清除缓存

 

info() 查看页面简介信息

file = urllib.request.urlopen("https://read.douban.com/provider/all")

file = urllib.request.urlopen("https://read.douban.com/provider/all",timeout=1)  #超时时间1S

print(file.info())

 

getcode()  返回网页爬取的状态码,正常200才可以爬取。

print(file.getcode())

 

geturl() 返回当前返回的页面url

print(file.geturl())

 posted on 2019-12-13 21:35  Godwall  阅读(229)  评论(0)    收藏  举报