►
Run
# Python XML Parsing import xml.etree.ElementTree as ET root = ET.parse('sample.xml').getroot() # iterate over child nodes for holiday in root.findall('holiday'): # get all attributes of a node attributes = holiday.attrib print(attributes) # get a particular attribute type = attributes.get('type') print(type)
Output