Feb-10-2022, 06:26 PM
thanks for the reply.
I can't get this working here is my code.
I have it trying to print clubs first to see if I can connect.. it was working and returning the whole table.. but it's not now, not sure why.
Even when it was returning the whole table in print, the print on "name" wasn't working.
slice indices must be integers or None or have an __index__ method
I can't get this working here is my code.
I have it trying to print clubs first to see if I can connect.. it was working and returning the whole table.. but it's not now, not sure why.
Even when it was returning the whole table in print, the print on "name" wasn't working.
from bs4 import BeautifulSoup import requests try: html = requests.get('https://fbref.com/en/squads/19538871/Manchester-United-Stats') html.raise_for_status() soup = BeautifulSoup(html.text, 'lxml') clubs = soup.find(class_='stats_table') for club in clubs: name = club.find('div', {'data-stat': 'player'}) print(clubs) except Exception as e: print(e)I'm getting this message on print
slice indices must be integers or None or have an __index__ method