【发布时间】:2020-06-10 16:47:35
【问题描述】:
我正在尝试网页抓取。然而,由于这个错误无法继续。如果有人能帮我解决这个问题,我会很好。
这是我的代码。
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen as uReq
my_url = "https://www.newegg.com/Video-Cards-Video-Devices/Category/ID-38?Tpk=graphics%20card"
uClient = uReq(my_url)
page_html = uClient.read()
uClient.close()
#html parsing
page_soup = soup(page_html,"html.parser")
containers = page_soup.findALL("div",{"class":"item-branding"})
下面是错误
TypeError Traceback(最近一次调用最后一次) 在 13 14 ---> 15 个容器 = page_soup.findALL("div",{"class":"item-branding"}) 16长(集装箱) 17
TypeError: 'NoneType' 对象不可调用
【问题讨论】:
-
尝试使用
find_all而不是findALL...! -
进展如何??
标签: python-3.x web-scraping beautifulsoup