- 1.安装lxml模块 - 2.pip install lxml (此处如果下载速度比较慢,可以通过查看之前的博客所写的方法) - 3.导入extree(from lxml import etree) - 4.tree = extree.XML() - 5.tree = extree.html() - 6.tree = extree.parse
- 2.pip install lxml (此处如果下载速度比较慢,可以通过查看之前的博客所写的方法)
- 3.导入extree(from lxml import etree)
- 4.tree = extree.XML()
- 5.tree = extree.html()
- 6.tree = extree.parse()
- 然后通过tree即可进行相关的xpath操作