ResultSet object has no attribute ‘text‘

简介: ResultSet object has no attribute ‘text‘

最近在学BeautifulSoup,我就尝试用这个来下载一本红楼梦/

原来是:

wenben=new_soup.find_all('div',{'class':'chapter_content'})
        print(wenben.text)

就报错:ResultSet object has no attribute 'text’后面一大堆

解决:

 for  wenben in new_soup.find_all('div',{'class':'chapter_content'}):
            print(wenben.text)

然后就下载好了:

1.png

相关文章
|
2月前
|
计算机视觉 Python
解决 NoneType‘ object has no attribute ‘astype’ 问题
解决 NoneType‘ object has no attribute ‘astype’ 问题
30 0
|
6月前
|
存储 JSON 数据格式
数据集加载时报错'dict' object has no attribute 'requests‘
数据集加载时报错'dict' object has no attribute 'requests‘
113 5
|
4月前
AttributeError: 'NoneType' object has no attribute 'to_capabilities'
AttributeError: 'NoneType' object has no attribute 'to_capabilities'
377 0
|
7月前
|
Python Windows
xlrd库报错【AttributeError: ‘ElementTree‘ object has no attribute ‘getiterator‘】
xlrd库报错【AttributeError: ‘ElementTree‘ object has no attribute ‘getiterator‘】
118 0
|
4月前
AttributeError ‘NoneType‘ object has no attribute ‘to_capabilities‘
AttributeError ‘NoneType‘ object has no attribute ‘to_capabilities‘
93 0
|
5月前
|
数据采集
运行爬虫时报错AttributeError—— 'str' object has no attribute 'capabilities'
运行爬虫时报错AttributeError—— 'str' object has no attribute 'capabilities'
254 0
|
5月前
'WebDriver' object has no attribute 'find_element_by_tag_name'
'WebDriver' object has no attribute 'find_element_by_tag_name'
118 0
|
9月前
yolov7—tensorrt报错AttributeError: ‘NoneType‘ object has no attribute ‘execute_v2‘已解决。
yolov7—tensorrt报错AttributeError: ‘NoneType‘ object has no attribute ‘execute_v2‘已解决。
90 0
yolov7—tensorrt报错AttributeError: ‘NoneType‘ object has no attribute ‘execute_v2‘已解决。
|
9月前
|
PyTorch 算法框架/工具
已解决虚拟机yolov5报错:AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
已解决虚拟机yolov5报错:AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
216 0
已解决虚拟机yolov5报错:AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
|
9月前
|
Python
AttributeError: 'dict' object has no attribute 'has_key'
AttributeError: 'dict' object has no attribute 'has_key'