摘要: BeautifulSoup from bs4 import BeautifulSoup soup=BeautifulSoup(url,'lxml')#lxml解析库速度快,文档容错能力强 soup=BeautifulSoup(url,'xml') soup=BeautifulSoup(url,'ht 阅读全文
posted @ 2018-07-08 23:43 陈小维努力ing 阅读(145) 评论(0) 推荐(0)
摘要: 正则表达式 字符串规则过滤匹配(re模块) tool.oschina.net#在线测试正则表达式 re.match(pattern,string,flags) pattern#正则表达式 string#匹配的字符串 flags#标志位 re.I 使匹配对大小写不敏感 re.L 做本地化识别(loca 阅读全文
posted @ 2018-07-08 23:29 陈小维努力ing 阅读(118) 评论(0) 推荐(0)
摘要: 1、urllib python 内置的http的请求库 urllib.request #请求模块 www=urllib.request.urlopen(url,data,timeout) www.read().decode('utf-8') type(www)#响应类型 www.status#响应状 阅读全文
posted @ 2018-07-08 23:22 陈小维努力ing 阅读(318) 评论(0) 推荐(0)
摘要: 爬虫-->请求网站并提取数据的自动化程序 1、发送http请求requests(headers) 2、获取响应respones 3、解析内容 4、保存数据 ***检查网页源代码 request 请求方式 get post(请求参数不包含在url内,需要构造相关表单) 请求URL URL:统一资源定位 阅读全文
posted @ 2018-07-08 23:17 陈小维努力ing 阅读(498) 评论(0) 推荐(0)