AttributeError: ResultSet object has no attribute ‘find_all’. You’re probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?
意思是:属性错误:ResultSet对象没有属性’find_all’。您可能将一个元素列表当作一个元素来处理。当您打算调用find()时,是否调用了find_all() ?

在爬取https://www.shicimingju.com/book/xiyouji.html时想要提取文章标题和标题内容到txt文件里出现以下错误:
AttributeError: ResultSet object has no attribute ‘find_all‘.
点开浏览器开发者工具看:a标签是存在于li标签中
AttributeError: ResultSet object has no attribute ‘find_all‘.
但是soup.select(’.book-mulu li’)返回的是一个列表对象,列表对象没有find_all方法,所以显示报错
AttributeError: ResultSet object has no attribute ‘find_all‘.
完整的爬取程序如下:
AttributeError: ResultSet object has no attribute ‘find_all‘.
打开当前目录下的西游记.txt文件:
AttributeError: ResultSet object has no attribute ‘find_all‘.

相关文章:

  • 2021-07-27
  • 2021-07-25
  • 2021-06-22
  • 2021-06-16
  • 2021-08-06
  • 2021-06-13
  • 2022-01-08
  • 2021-04-18
猜你喜欢
  • 2021-06-21
  • 2021-08-31
  • 2021-12-04
  • 2021-12-06
  • 2021-09-15
  • 2021-12-07
  • 2021-06-06
相关资源
相似解决方案