xam1816

Опять нужна корректировка
def scorepredictor():
global predicts
predicts['scorepredictor'] = []
resp = requests.get(r'http://www.scorepredictor.net/index.php?section=football')
if resp.ok:
soup = BeautifulSoup(resp.content, 'html.parser')
if table := soup.find("div", class_="tab_content").find('tbody'):
for tr in table.find_all('tr'):
td = tr.find_all('td')
predicts['scorepredictor'].append({'game': f'{td[1].text} vs {td[7].text}', 'predict': td[9].text})
или так ?
def scorepredictor():
global predicts
predicts['scorepredictor'] = []
resp = requests.get(r'http://www.scorepredictor.net/index.php?section=football')
if resp.ok:
soup = BeautifulSoup(resp.content, 'html.parser')
if table := soup.find("div", class_="tab_dark").find('tbody'):
for tr in table.find_all('tr'):
td = tr.find_all('td')
predicts['scorepredictor'].append({'game': f'{td[1].text} vs {td[4].text}', 'predict': td[6].text})