在我工作的公司中,我不得不深入研究这部分代码。您的其中一个解析失败,并且怀疑这部分代码存在错误,但由于我的经验不足,我无法确切地弄清楚它应该做什么。
from lxml import etree
uni = etree.tounicode
def results(self):
return [(e.attrib['href'], uni(e))
for e in self.doc.xpath('//li[@class="g" and not(class="localbox")]//a[@class="l"]')]