Jan-07-2021, 07:02 AM
In your loop where you're setting link_list, append it to a list that it outside the loop.
You've created such a list on line 41. But line 41 is useless because the variable is overwritten later by line 44.
Perhaps a bit more like...
You've created such a list on line 41. But line 41 is useless because the variable is overwritten later by line 44.
Perhaps a bit more like...
start = '="' end = '">' link_list = [] for link in soup.findAll('a'): if "match_id" in link.get('href'): link_list.append(str(link).split(start)[1].split(end)[0])