import lxml as lxml
import requests
from lxml import etree
url = '网站名'
response = requests.get(url)
print(response.text)
data = etree.HTML(response.text)
div_list = data.xpath('//div[@class="info clear"]')
for i in div_list:
title = i.xpath()
print(title)
会显示:“在 'function' 中找不到引用 'HTML' ”
运行时报错: data = etree.HTML(response.text)
AttributeError: 'function' object has no attribute 'HTML'