工具:python3
核心知识点:
1)lxml包不能用pip下载,要使用apt-get,因为里面有其他语言编写的文件
2)urlopen返回的请求是html文件,要使用 content = etree.HTML(html)来将其转换为xml,html dom格式
3)使用content.xpath()返回一个匹配成功的列表集合
4)构造新的url,进入这个url,进行数据爬取
问题:在执行loadPage时遇到了问题,
link_list = content.xpath('//div[@class="t_con cleafix"]/div/div/div/a/@href')
这个匹配规则在xpath helper中能够找到对应的href值:
<