尝试按照教程构建网络爬虫,并不断获取findall的属性错误

问题描述 投票:0回答:1

从urllib.request导入urlopen作为uReq从bs4进口BeautifulSoup作为汤导入re

my_url ='https://www.newegg.ca/p/pl?d=graphics+cards&N=100007708&name=Desktop%20Graphics%20Cards'

uClient = uReq(my_url)

page_html = uClient.read()

uClient.close()

page_soup =汤(page_html,'html.parser')

container = page_soup.findall('div',{'class':'item-info'})]

len(容器)

追踪(最近通话):文件“ C:/Users/PycharmProjects/Web_Scraper/Web_Scraper.py”,第12行container = page_soup.re.findall('div',{'class':'item-info'})AttributeError:“ NoneType”对象没有属性“ findall”

python web-scraping web-crawler
1个回答
0
投票

如果将findall替换为find_all,则错误将得到解决。

© www.soinside.com 2019 - 2024. All rights reserved.