Last active
November 13, 2020 20:36
-
-
Save gmariette/0c4fa71137f69dc76d9230108ea863d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # # 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