Python search data within XML elements

Happ

New Member
I thought this would work for searching for tag values of "error"\[code\]import xml.etree.cElementTree as ETxml = """ <tag1> <tag2> error </tag2> <tag3> working </tag3> <tag4> <tag5> error </tag5> </tag4> </tag1>"""for event, element in ET.fromstring(xml): if element.text.strip() == "error": print element.tag\[/code\]I run in to the following error:\[code\]Traceback (most recent call last): File "test.py", line 19, in <module> for event, element in ET.fromstring(xml):ValueError: need more than 0 values to unpack\[/code\]What does "need more than 0 values to unpack" mean?
 
Back
Top