Beautiful Soup 'ResultSet' object has no attribute 'text'

前端 未结 3 752
孤独总比滥情好
孤独总比滥情好 2021-01-12 10:51
from bs4 import BeautifulSoup
import urllib.request
import win_unicode_console
win_unicode_console.enable()


link = (\'https://pietroalbini.io/\')  
req = urllib.re         


        
3条回答
  •  孤城傲影
    2021-01-12 11:17

    find_all returns a ResultSet object which you can iterate over using a for loop. What you can do is:

    for wrapper in body.find_all('div', {"class":"wrapper"}):
       print wrapper.text
    

提交回复
热议问题