Skip to content

Instantly share code, notes, and snippets.

@gmariette
Last active November 13, 2020 20:36
Show Gist options
  • Select an option

  • Save gmariette/0c4fa71137f69dc76d9230108ea863d5 to your computer and use it in GitHub Desktop.

Select an option

Save gmariette/0c4fa71137f69dc76d9230108ea863d5 to your computer and use it in GitHub Desktop.
# # Analysis with beautifulsoup
soup = BeautifulSoup(response.content, 'html.parser')
table = soup.find("table",{"class":"result"})
table_body = table.find('tbody')
logging.debug(table_body)
rows = table_body.find_all('tr')
tournament_idx_lst = []
for i, row in enumerate(rows):
if '<tr class="head flags">' in str(row):
t_name = row.find("td",{"class":"t-name"}).text
logging.debug(t_name)
tournament_idx_lst.append(i)
logging.info("%s is located at line %s of the tbody", t_name, i)
tournament_idx_lst.append(len(rows))
logging.info(tournament_idx_lst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment