Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.rst

How to read a XML file?

The builtin module xml parses XML files. It contains several XML parsers. They all produce a tree of element objects for each tag that can be searched and allow access to attributes.

The following code parses the XML file :download:`hamlet.xml`:

.. literalinclude:: parse_xml.py

How to write a XML file?

You can create a tree of elements from scratch and write it to a XML file:

.. literalinclude:: write_xml.py

.. seealso::

   `Documentation of the XML module <https://docs.python.org/3/library/xml.html>`__