from xml.etree import ElementTree root = ElementTree.Element('person') first = ElementTree.SubElement(root, 'first_person') first.text = 'John Smith' tree = ElementTree.ElementTree(root) tree.write('test.xml')
John Smith