import xml.etree.ElementTree as ET
def parse_xml(file):
tree = ET.parse(file)
root = tree.getroot()
return root
weapons = []
for item in parse_xml('file.xml').findall('items'):
for i in item.findall('attribute'):
if i.attrib['key'] != "weaponType":
continue
if i.attrib['value'] != "frooitensplox":
continue
weapons.append(item.attrib['name'])