爬虫练习——爬取纵横中文网
import requests,os #导入模块
from lxml import etree
ress = requests.get('http://book.zongheng.com/store.html') #纵横中文的书库
html = etree.HTML(ress.text) #转译
db = html.xpath('//div[@class="bookname"]/a/@href') #筛选书库书的链接
for a in range(3): #循环前3本小说源代码
res0 = requests.get(db[a]

本文是初级爬虫学习者的实战分享,详细介绍了如何使用Python和XPath技术爬取纵横中文网站的数据,提供了相关代码示例。

2944

被折叠的 条评论
为什么被折叠?



