Я пытаюсь собрать биржевые тикеры из https://finance.yahoo.com/u/yahoo-finance/watchlists/420_stocks/, и получаю сообщение об ошибке атрибута.
Я также пытался найти findAll и find_All, как с заглавной буквы A, так и с нижним регистром.
def cannabisTickersList():
page = urllib.request.urlopen('https://finance.yahoo.com/u/yahoo-finance/watchlists/420_stocks/').read()
soup = bs.BeautifulSoup(page, 'lxml')
table = soup.find_all('table', {"class" : 'cwl-symbols'})
cannabisTickers = []
for table in table.find_all('tr'):
cannabisTicker = table.find_all('td')
cannabisTickers.append(cannabisTicker)
with open("cannabisTickers.pickle", "wb") as f:
pickle.dump(cannabisTickers, f)
print([s.strip('\n') for s in cannabisTickers])
return cannabisTickers
"ResultSet object has no attribute '%s'. You're probably treating a list of items like a single item. Did you call find_all() when you meant to call find()?" % key
AttributeError: Объект ResultSet не имеет атрибута 'find_all'.Вы, вероятно, рассматриваете список предметов как отдельный предмет.Вы вызывали find_all (), когда хотели вызвать find ()?