Python “美丽群秀”';非类型';对象不可调用";使用find_all时
基本上,我想从class=“something”所在的标签中刮取href。但我遇到了一个错误,即Python “美丽群秀”';非类型';对象不可调用";使用find_all时,python,web-scraping,beautifulsoup,Python,Web Scraping,Beautifulsoup,基本上,我想从class=“something”所在的标签中刮取href。但我遇到了一个错误,即'NoneType'对象不可调用以下是我的代码: soup = BeautifulSoup(thr_data) # where thr_data is the response.read() images = soup.find_all("a", {"class" : "something"}) for link in images: cr_link = link['href'] h
'NoneType'对象不可调用
以下是我的代码:
soup = BeautifulSoup(thr_data) # where thr_data is the response.read()
images = soup.find_all("a", {"class" : "something"})
for link in images:
cr_link = link['href']
html是这样的
当我使用find\u all时,我会得到相同的错误。这就是为什么我总是使用findAll。我不知道为什么,可能是在一些升级版的Beautifulsoup作品中针对这两个 好的,问题显然出在BeautifulSoup版本上。我必须通过安装python-bs4
来获得最新版本。然后从bs4 import BeautifulSoup导入模块