here is my code:
url_joueurs = ('https://www.basketball-reference.com/leagues/NBA_2022_per_game.html')
result = requests.get(url_joueurs).text
data = BeautifulSoup(result, 'html.parser')
comments = data.find_all(string=lambda text: isinstance(text, Comment))
tables = []
for each in comments:
if 'table' in str(each):
try:
tables.append(pd.read_html(str(each), attrs = {'id': 'totals_stats'})[0])
break
except:
continue
Stats_joueurs = tables
print(Stats_joueurs)
The problem is that it returns an empty list (pd.df is outputted contained in a list).
Do you have an idea where the problem is ?
Thanks you.