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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -