擅长:python、mysql、java
<p>你可以试试这个:
在</p>
<pre class="lang-py prettyprint-override"><code>In [1]: import xml.etree.ElementTree as ET
In [2]: tree = ET.parse('test.xml')
In [3]: root = tree.getroot()
In [4]: for el in root:
...: print el.find('data').text
...:
...:
aaaa
bbbb
cccc
</code></pre>
<p>您所提供的代码中唯一缺少的是<code>elem.find('data').text</code>(在<code>for</code>循环中),它将返回您要查找的值。在</p>