Python 如何解决’NoneType’ object has no attribute '…'的问题
用 Python + selenium 和Beautifulsoup 爬取MOCC中国大学慕课网上某网上课程的课堂评论,在爬取少量数据时不出现标题所示错误,在爬取大量数据(运用到翻页操作)时出现 ‘NoneType’ object has no attribute ‘text’ 的错误。请问各位大佬原因,和解决方法
//
b1
= a1
.find_all
('div', attrs
={'style': "z-index: 0;"})
for bb
in b1
:
c1
= bb
.find_all
('div', recursive
=False)
for c
in c1
:
username
= c
.find
('span', attrs
={'class': "userInfo j-userInfo"})
Dict_all
["r_User_" + str(b1
.index
(bb
)) + str(c1
.index
(c
))] = username
.text
转载请注明原文地址: https://www.6miu.com/read-5029240.html