我对python世界非常陌生,我有一个新的要求,我需要打印节点值和节点名Python。但是我遇到了一些错误。 谁能帮我。。。!!!!在
这是我的xml示例:
<task chapnbr="05" sectnbr="41" subjnbr="05" func="210" seq="8" pgblknbr="2" chg="N" key="4B5014E906" revdate="20051230">
<effect effrg="801899" efftext="ZAP ALL" />
<title>WING</title>
<refblock>(<grphcref refid=NAX00000>Figure 208</grphcref>)</refblock>
<tfmatr>
<pretopic>
<title>General</title>
<list1>
<l1item>
<para>This procedure is a scheduled maintenance task.</para>
</l1item>
</list1>
</pretopic>
</tfmatr>
<topic>
<title>Zonal Inspection</title>
<subtask chapnbr="05" sectnbr="41" subjnbr="05" func="210" seq="008" pgblknbr="2" chg="N" key="B7A276D9D" revdate="20051230">
<effect effrg="8018" efftext="ZAP ALL" />
<list1>
<l1item>
<para>Do the zonal inspection.</para>
</l1item>
</list1>
</subtask>
</topic>
<graphic chapnbr="05" sectnbr="41" subjnbr="05" func="990" seq="808" pgblknbr="2" chg="N" key=NAX00000 revdate="20051230">
<effect effrg="801899" efftext="ZAP ALL" />
<title>Figure 208. Leading Edge to Front Spar (Outboard of Nacelle Strut) Left Wing - General Visual (External)</title>
<sheet gnbr="811DE0C" sheetnbr="1" chg="N" key="5C152" revdate="20051230">
<effect effrg="801899" efftext="ZAP ALL" />
</sheet>
</graphic>
</task>
我的python代码示例:
^{pr2}$我正在低于错误。在
因为xml.etree.ElementTree.Element对象没有属性childNodes。在
要迭代childern元素,只需执行
for child in elem
。在相关问题 更多 >
编程相关推荐