import xml.etree.ElementTree as ET
root = ET.Element('Configuration')
student = ET.SubElement(root, 'student')
ET.SubElement(student, 'name').text = 'A'
ET.SubElement(student, 'years').text = '20'
# Test the result
import xml.dom.minidom
dom = xml.dom.minidom.parseString(ET.tostring(root))
print(dom.toprettyxml())
The result is below.
<?xml version="1.0" ?>
<Configuration>
<student>
<name>A</name>
<years>20</years>
</student>
</Configuration>