引入模块
在pycharm中下载lxml库
通过from lxml import etree引入模块
测试
1 | import requests |


这里是通过xpath语法将论坛的所有tbody便签1
print(html.xpath('//tbody/tr/th/a[@class="s xst"]/text()'))

在pycharm中下载lxml库
通过from lxml import etree引入模块
1 | import requests |


这里是通过xpath语法将论坛的所有tbody便签1
print(html.xpath('//tbody/tr/th/a[@class="s xst"]/text()'))

原文作者:浩翰
原文链接:https://plutoacharon.github.io/2019/11/28/使用etree与xpath爬取Discuz论坛/
发表日期:November 28th 2019, 5:38:36 pm
更新日期:November 28th 2019, 5:39:13 pm
版权声明:本文采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: true
tags: true