XML は次のとおりです。
<top>
<target>
<name>TARGET_NAME_1</name>
<error_count>5</error_count>
<error_examples>a string goes here</error_examples>
</target>
<target>
<name>TARGET_NAME_2</name>
<error_count>5</error_count>
<error_examples>a string goes here</error_examples>
</target>
</top>
ここに私がしようとしているものがあります:
tree = ETREE.parse(str(XML_FILE_PATH)) #this seems to work
top = tree.getroot()
targets = top.findall('target')
for target in targets:
print target
これは私に<Element target at HEX_NUMBER>
. では、各ターゲットの値を抽出するにはどうすればよいTARGET_NAME_1
でしょうか。
乾杯
編集-私はPythonバージョン2.6を使用していることに言及する必要があります