summaryrefslogtreecommitdiffstats
path: root/Doc/library/xml.etree.elementtree.rst
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-08-23 14:44:25 (GMT)
committerGitHub <noreply@github.com>2019-08-23 14:44:25 (GMT)
commitb5d3ceea48c181b3e2c6c67424317afed606bd39 (patch)
tree6ee510b9c8db32251e3aed8a16b186ac08c3f04f /Doc/library/xml.etree.elementtree.rst
parent81446fd0d4fa60042ac2752350f31004324510f9 (diff)
downloadcpython-b5d3ceea48c181b3e2c6c67424317afed606bd39.zip
cpython-b5d3ceea48c181b3e2c6c67424317afed606bd39.tar.gz
cpython-b5d3ceea48c181b3e2c6c67424317afed606bd39.tar.bz2
bpo-14465: Add an indent() function to xml.etree.ElementTree to pretty-print XML trees (GH-15200)
Diffstat (limited to 'Doc/library/xml.etree.elementtree.rst')
-rw-r--r--Doc/library/xml.etree.elementtree.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst
index 9f46755..6047e6e 100644
--- a/Doc/library/xml.etree.elementtree.rst
+++ b/Doc/library/xml.etree.elementtree.rst
@@ -572,6 +572,18 @@ Functions
.. versionadded:: 3.2
+.. function:: indent(tree, space=" ", level=0)
+
+ Appends whitespace to the subtree to indent the tree visually.
+ This can be used to generate pretty-printed XML output.
+ *tree* can be an Element or ElementTree. *space* is the whitespace
+ string that will be inserted for each indentation level, two space
+ characters by default. For indenting partial subtrees inside of an
+ already indented tree, pass the initial indentation level as *level*.
+
+ .. versionadded:: 3.9
+
+
.. function:: iselement(element)
Checks if an object appears to be a valid element object. *element* is an