March 2019
Beginner
490 pages
12h 40m
English
The lxml parser (https://lxml.de ) is the main module for analysis of XML documents and libxslt.
The main module features are as follows:
The installation of the XML parser can be done through the official repository:
pip install lxml
lxml.etree is a submodule within the lxml library that provides methods such as XPath(), which supports expressions with XPath selector syntax. With this example, we see the use of the parser to read an HTML file and extract the text from the title tag through an XPath expression:
from lxml import html,etreesimple_page = open('data/simple.html').read()parser = etree.HTML(simple_page) ...Read now
Unlock full access