Python 3.x 如何在python中迭代xml树时更改xml路径?
我试图根据绝对路径从xml树中查找所有直接子元素 由于机密,我无法附加xmlPython 3.x 如何在python中迭代xml树时更改xml路径?,python-3.x,elementtree,xml.etree,python-xmlschema,Python 3.x,Elementtree,Xml.etree,Python Xmlschema,我试图根据绝对路径从xml树中查找所有直接子元素 由于机密,我无法附加xml full_entry_point=".//Home/sub/Entry/accessory/Entry" default_entry=".//Home/sub/Entry" 我在下面的for循环中尝试迭代“default_entry”,一旦我获取了标记,我需要根据条件将迭代切换到循环中的full_entry_点 status = False for entry in tree
full_entry_point=".//Home/sub/Entry/accessory/Entry"
default_entry=".//Home/sub/Entry"
我在下面的for循环中尝试迭代“default_entry”,一旦我获取了标记,我需要根据条件将迭代切换到循环中的full_entry_点
status = False
for entry in tree.findall(default_entry.lower()):
path="somepath"
find_result = entry.find(path).text()
if status== True:
"""
Here i need to change the iteration value of 'entry' from 'default_entry' to 'full_entry_point'
like
entry should point to 'tree.findall(full_entry_point.lower())'
that mean it should fetch direct child element of 'full_entry_point'
"""
请让我知道如何才能达到同样的效果
谢谢