python operation xpath 0227

Installation Library

Installed skip this step

pip install lxml

Import module

from lxml import etree

Object get

obj = etree.HTML(网页代码)

Extract content using xpath

res = obj.xpath(表达式)

Note:
If the expression is to get a label object
so that the object can continue to use xpath method

Published 941 original articles · won praise 44 · views 130 000 +

Guess you like

Origin blog.csdn.net/ifubing/article/details/104545299