擅长:python、mysql、java
<p>可以使用XPath递归搜索:</p>
<pre><code>>>> from lxml import etree
>>> q = etree.fromstring('<xml><hello>a</hello><x><hello>b</hello></x></xml>')
>>> q.findall('hello') # Tag name, first level only.
[<Element hello at 414a7c8>]
>>> q.findall('.//hello') # XPath, recursive.
[<Element hello at 414a7c8>, <Element hello at 414a818>]
</code></pre>