March 2019
Beginner
490 pages
12h 40m
English
The xml package is part of the Python standard library and contains in turn a series of packages and modules specializing in the management and manipulation of keyed documents.
The xml.etree.ElementTree package specializes in XML documents and contains various classes and functions that can be used for that purpose.
Let's see how we may create the previously mentioned example XML document by using ElementTree. Open a Python interpreter and run the following commands:
>>> import xml.etree.ElementTree as ET>>> root = ET.Element('root')>>> ET.dump(root)<root />
We start by creating the root element, that is, the outermost element of the document. The <root /> representation is an XML shortcut for <root></root> ...
Read now
Unlock full access