BeautifulSoup为什么显示'NoneType' object has no attribute 'find_all'
时间: 2023-10-23 17:41:56 浏览: 59
当BeautifulSoup对象无法找到所需的标签或属性时,它会返回`None`而不是一个Tag或ResultSet对象。因此,如果您尝试在`None`对象上调用`.find_all()`方法,会出现'NoneType' object has no attribute 'find_all'的错误。
通常,这种情况发生在您使用了错误的标签或属性名称,或者您的HTML文档中根本没有该标签或属性。请确保您的代码正确地引用了标签和属性,并且您的HTML文档中包含这些标签和属性。