在抓取网站后,我曾经应用过功能find_all 但不能再次申请
为什么?
>>> from requests import get
>>> with get(url) as conn:
print(conn)
>>> soap = BeautifulSoup(conn.content,"lxml")
>>> MAIN_DATA = soap.find_all("div",{"class" :"SOMETHING"})
>>> MAIN_DATA.find(SOMETHING) # WHY I CANNOT APPLY find and findall Function to this object
THANKS
答案 0 :(得分:0)
我认为您需要循环遍历find_all:
for div in soap.find_all("div")
答案 1 :(得分:0)
使用
for divs in MAIN_DATA:
divs.find(SOMETHING)