I have an XML
element with several attributes. I\'ve been using the ElementTree
package.
After I\'ve parsed a tree from an xml fil
The attrib
attribute of an ElementTree element (like the root returned by getroot
) is a dictionary. So you can do, for example:
from xml.etree import ElementTree
tree = ElementTree.parse('test.xml')
root = tree.getroot()
print root.attrib
which will output, for your example
{'a': '1', 'b': '2', 'c': '3'}