我一直在回顾如何使用XPass和lxml从网站读取HTML语言的示例。由于某些原因,当我尝试处理本地文件时,我总是遇到这个错误。
AttributeError: 'str' object has no attribute 'content'这是代码
with open(r'H:\Python\Project\File','r') as f:
file = f.read()
f.close()
tree = html.fromstring(file.content)https://stackoverflow.com/questions/47492533
复制相似问题