This code doesn't work but I don't understand what is this reason?
Could you give me a hand?
import requests
from bs4 import BeautifulSoup
from pprint import pprint
URL = "https://www.diretta.it/calcio/inghilterra/premier-league/classifiche/"
r = requests.get(URL)
r.raise_for_status()
soup = BeautifulSoup(r.text, 'html.parser')
data = []
row = soup.find_all('class', attrs={'ui-table__row'})
element = row.find('tableCellParticipant__name')
for element in elements:
data.append(element.text)
pprint(data)
0 Replies