
import xml.etree.ElementTree as etree

root = etree.Element("MyRoot" )
myData = 5
root.attrib['something'] = str(myData)
root.text="My Text"



#First child:
child = etree.Element("MyChild")
root.append(child)

child.text="Hi there!"


#2nd child:
oscar = etree.SubElement(root, "boy")
oscar.attrib['weight'] = '10lb'


tree = etree.ElementTree(root)

tree.write("myFile.xml", "UTF-8")


print("All done!")
