#创建xml import xml.etree.ElementTree as ET new_xml = ET.Element('namelist') personinfo = ET.SubElement(new_xml, 'personinfo', attrib = {'enroll' :yes}) age = ET.SubElement(personinfo,'name', attrib = {'check':'no'}) name = ET.SubElement(personinfo,'a…