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