xpath解析html文件报错:lxml.etree.XPathEvalError: Invalid expression

1.反斜杠的问题:
错误示范:title = sel.xpath(’//div/h2/a text()’)
正确:title = sel.xpath(’//div/h2/a/text()’)

你可能感兴趣的:(xpath)