bs4 - BeautifulSoup, TypeError: 'NoneType' 对象不可调用



为什么会出现此错误?(我知道这个问题缺乏很多细节,但我很着急,我的代码非常简单,所以如果有人帮助我,我会很棒(

from urllib.request import urlopen as ureq
from bs4 import BeautifulSoup
url = 'https://www.macrotrends.net/stocks/charts/BABA/alibaba/balance-sheet'
client = ureq(url)
page_html = client.read()
client.close()
page_soup = BeautifulSoup(page_html, 'html.parser')
balance_sheet = page_soup.findALL("div",{"id":"row10jqxgrid"})
balance_sheet
TypeError                                 Traceback (most recent call last)
<ipython-input-81-6a2377c6bfca> in <module>
1 page_soup = BeautifulSoup(page_html, 'html.parser')
----> 2 balance_sheet = page_soup.findALL("div",{"id":"row10jqxgrid"})
3 balance_sheet
TypeError: 'NoneType' object is not callable
balance_sheet = page_soup.findALL("div",{"id":"row10jqxgrid"})

在你的代码中,你已经写了 查找全部 大写 . 写入 findAll 而不是 findALL

balance_sheet = page_soup.findAll("div",{"id":"row10jqxgrid"})

最新更新