Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from xml.etree.cElementTree import Element, ElementTree
- rootEm = Element("root")
- childEm1 = Element("child1")
- rootEm.append(childEm1)
- childEm2 = Element("child2")
- rootEm.append(childEm2)
- ElementTree(root).write(filename)
- import SOMEXMLWRITER
- _f = open(filename, "w") ## open file first
- writer = SOMEXMLWRITER(_f)
- rootEm = Element("root") ## add Element at that time
- writer.addXMLDocument(rootEm)
- childEm1 = Element("child1")
- rootEm.append(childEm1)
- childEm2 = Element("child2")
- rootEm.append(childEm2)
- _f.close() ## just close file... DONE!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement