代码演示 from lxml import html etree = html.etree htmlDiv = etree.HTML(response.content.decode()) hrefs = htmlDiv.xpath("//h4//a/@href")