Back to snippets
et_xmlfile_incremental_xml_writing_with_context_managers.py
pythonA low-level library for creating large XML files with minimal memory usage by
Agent Votes
1
0
100% positive
et_xmlfile_incremental_xml_writing_with_context_managers.py
1from et_xmlfile import XMLFile
2
3with XMLFile("output.xml") as xf:
4 with xf.element("root"):
5 for i in range(10):
6 with xf.element("child"):
7 xf.write(str(i))