python - xml.etree.ElementTree findall() not behaving as expected -
>>> import xml.etree.elementtree et >>> t = et.fromstring('<root><field name="tcp.option_len" ></field></root>') >>> t.findall('.//field [@name="tcp.option_len"]') []
why isn't field
returned?
simply remove space in xpath query b/n field , bracket [
t.findall('.//field[@name="tcp.option_len"]')
Comments
Post a Comment