【发布时间】:2014-03-21 13:57:32
【问题描述】:
如果我有这样的 xml 文件:
<root>
<item>
<prop>something</prop>
</item>
<test>
<prop>something</prop>
</test>
<test2>
<prop>something</prop>
</test2>
</root>
我可以使用
xmlTree.getroot().findall("item")
获取所有“项目”元素。
如何获得所有“项目”或“测试”元素?我想要类似的东西:
xmlTree.getroot().findall("item or test")
我在文档的示例中没有看到类似的内容。有什么想法吗?
【问题讨论】:
标签: python elementtree