Python: xPath not available in ElementTree
问题 I am trying to parse iTunes Playlist by using iterparse() of ElementTree but getting following error: AttributeError: 'Element' object has no attribute 'xpath' Code is given below: import xml.etree.ElementTree as ET context = ET.iterparse(file,events=("start", "end")) # turn it into an iterator context = iter(context) # get the root element event, root = context.next() for event, elem in context: z = elem.xpath(".//key") elem.clear() root.clear() print z What I am doing wrong? File is too big