ADD file via upload

main
mxfqc3yh7 7 months ago
parent 99579baf56
commit 803baa5dc6

17
X.py

@ -0,0 +1,17 @@
from lxml import etree
html="""
<body>
<div>
<h1>Page Title</h1>
<p>Some text.</p>
<h2>Section 1</h2>
<p>More text.</p>
<h2>Section 2</h2>
</div>
</body>
"""
from lxml import etree
selector = etree.HTML(html)
#修改xpath表达式
result = selector.xpath('//h2')
print(result)
Loading…
Cancel
Save