xml.etree.ElementTree中的python xpath
我将xml.etree.ElementTree中的python xpath,python,xpath,Python,Xpath,我将xml.etree.ElementTree与函数root.findall(xpath) 我如何找到所有具有“Status”child且文本为“Pass”的根“child” <Root> <Some_Element> <!-- I want only this element --> <Status>Pass</Status> </Some_Element> <Some_Ele
xml.etree.ElementTree
与函数root.findall(xpath)
我如何找到所有具有“Status”child且文本为“Pass”的根“child”
<Root>
<Some_Element> <!-- I want only this element -->
<Status>Pass</Status>
</Some_Element>
<Some_Element>
<Status>Fail</Status>
</Some_Element>
</Root>
通过
失败
谢谢试试类似的东西
elements = [x for x in root.findall("Some_Element") if x.find("Status").text == "Pass"]