From 803baa5dc64c6396ff18a4069aeacef762f61db1 Mon Sep 17 00:00:00 2001 From: mxfqc3yh7 <1306884653@qq.com> Date: Wed, 17 Apr 2024 10:53:36 +0800 Subject: [PATCH] ADD file via upload --- X.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 X.py diff --git a/X.py b/X.py new file mode 100644 index 0000000..1ffd621 --- /dev/null +++ b/X.py @@ -0,0 +1,17 @@ +from lxml import etree +html=""" + +
+

Page Title

+

Some text.

+

Section 1

+

More text.

+

Section 2

+
+ +""" +from lxml import etree +selector = etree.HTML(html) +#修改xpath表达式 +result = selector.xpath('//h2') +print(result)