爬虫与正则

时间:2019-03-20 18:59:12
【文件属性】:
文件名称:爬虫与正则
文件大小:793KB
文件格式:RAR
更新时间:2019-03-20 18:59:12
正则 from bs4 import BeautifulSoup import requests urlIndex = [] head = {"User-Agent":"Mozila/5.0(Window NT 6.1; AppleWebKit/537.36 ; Chrome/47.0.2526.106 Safari/537.36 )"} TimeOut=5 root="http://money.163.com/special/002534M5/review.html" Page =requests.session().get(root,headers=head,timeout=TimeOut) Coding= (Page.encoding) contens= Page.content soup= BeautifulSoup(contens,from_encoding="gbk") for result in soup.select("div.colLM li"): urlIndex.append(result) for result2 in urlIndex: title= result2.span.text wangzhi=(result2.a)["href"] shijian=(result2.select(".atime"))[0].text print shijian
【文件预览】:
爬虫完整与正则图解
----我的爬虫,提取标题和时间()
--------我的爬虫,提取时间和标题.png(23KB)
--------我的爬虫,提取时间和标题.py(43KB)
--------我的爬虫,提取标题和时间.txt(43KB)
----某妹纸的爬虫()
--------某妹纸的爬虫.jpg(397KB)
--------某妹纸的爬虫.txt(631B)
----爬虫完整()
--------正则图解.png(117KB)
--------获取title中li中的内容爬虫内容.txt(500B)
--------爬时间.png(15KB)
--------爬去class中 a中title和时间完整版.txt(320B)
--------爬去class中 a中title和时间完整版.py(321B)
--------获取title中li中的内容爬虫内容.py(501B)
--------源代码.png(50KB)
----我的正则图解()
--------正则和源代码关系图解其他图片()
--------正则和源代码关系图解.txt(2KB)
--------正则和源代码关系图解.png(120KB)
--------正则和源代码关系图解.py(2KB)

网友评论