摘要: #导入urllib库 import urllib.request #打开网址 file=urllib.request.urlopen("http://www.sohu.com/",timeout=5) #读取网页源码 file.read().decode("utf-8","ignor") #返回爬取网页的状态码 print(file.getcode()) #获取当前访问网页的url print(... 阅读全文
posted @ 2018-04-14 17:17 xsan 阅读(259) 评论(0) 推荐(0) 编辑