我是一名新手,正在学习xml。希望能够使用XPath和Python ElementTree格式搜索xml文件。
<root>
<child>One</child>
<child>Two</child>
<child>Three</child>
</root>
搜索带有“Two”的子项,并返回true/false。
如果开始的方式如下:
from elementtree import ElementTree
root = ElementTree.parse(open(PathFile)).getroot()
如何实现这个目标?