From be24181e393b6d3ef28fb645e17fa4106faba55d Mon Sep 17 00:00:00 2001 From: pbqs4lvtu <1779073549@qq.com> Date: Wed, 17 Apr 2024 14:11:54 +0800 Subject: [PATCH] Update X.py --- X.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/X.py b/X.py index 1ffd621..88011f8 100644 --- a/X.py +++ b/X.py @@ -1,17 +1,18 @@ -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) +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) +printf(selector) \ No newline at end of file