这样的事情应该起作用:
import lxml.etree as etns = {"atom": "http://www.w3.org/2005/Atom"}tree = et.fromstring(xml)for node in tree.xpath('//atom:entry', namespaces=ns): print node另请参见http://lxml.de/xpathxslt.html#namespaces-and-
prefixes。
选择:
for node in tree.xpath("//*[local-name() = 'entry']"): print node


