对于这个 xml
<Departments orgID="123" name="xmllist">
<Department>
<orgID>124</orgID>
<name>A</name>
<type>type a</type>
<status>Active</status>
<Department>
<orgID>125</orgID>
<name>B</name>
<type>type b</type>
<status>Active</status>
<Department>
<orgID>126</orgID>
<name>C</name>
<type>type c</type>
<status>Active</status>
</Department>
</Department>
</Department>
<Department>
<orgID>109449</orgID>
<name>D</name>
<type>type d</type>
<status>Active</status>
</Department>
</Departments>
我如何lxml
etree
在 python 中使用节点的所有父节点。
预期输出:输入 orgid=126 ,它将返回所有的父母喜欢,
{'A':124,'B':125,'C':126}