I'm able to print it out to the console, and it is the way I want it, but I can't seem to grasp on how to save it. The XML from the sample doesn't change. I'm using fairly big XML files and the iterparse function, as I believe is crucial.
My code:
def xmlTagMethod(xmlfile, changetag):
tree = ET.ElementTree(file=xmlfile)
root = tree.getroot()
for event, elem in ET.iterparse(xmlfile):
if event == 'end':
if elem.tag == changetag:
elem.set('maxwidth', '20')
print elem.attrib
tree.write("outPutTagData.xml")