import xml.etree.ElementTree as etree
tree = etree.parse('test.xml')
root = tree.getroot()

def xml_to_dict(el):
    d = {}
if el.text:
    d[el.tag] = el.text
else:
    d[el.tag] = {}
children = el.getchildren()
if children:
    d[el.tag] = map(xml_to_dict, children)
return d
Редактировать XML как словарь в python?