RosettaCodeData/Task/XML-DOM-serialization/Python/xml-dom-serialization-2.py

6 lines
152 B
Python

from xml.etree import ElementTree as et
root = et.Element("root")
et.SubElement(root, "element").text = "Some text here"
xmlString = et.tostring(root)