您可以使用XPath进行递归搜索:
>>> 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>]


