I am able to create a xml file with below code but what I am after is this. Does anyone have a clue as to what change is needed in the code to achieve this?
import xml.etree.cElementTree as ET root = ET.Element("root") ET.SubElement(root, "field1", name="blah").text = "some value1" ET.SubElement(root, "field2", name="hi").text = "some value2" ET.SubElement(root, "field3", name="asdfasd").text = "some vlaue3" tree = ET.ElementTree(root) tree.write("filename.xml")
No comments:
Post a Comment