I thought this would work for searching for tag values of "error"
import xml.etree.cElementTree as ET
xml = """
<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
I run in to the following error:
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
What does "need more than 0 values to unpack" mean?