如图,这里有2个span标签,id都一样。我想爬去第二个span标签的内容。当我使用total=bs.find_all(id='total-comments')[1].text时,回报超出范围的错。改为使用total=bs.find(id='total-comments').text就可以正常提取。小白刚刚学爬虫,不是很明白为什么不能用find_all()[]的形式?
total=bs.find_all(id='total-comments')[0].text