Created
March 22, 2018 02:55
-
-
Save kanazux/11b7b61ec0a10ab3aaa7d180d31e5496 to your computer and use it in GitHub Desktop.
renomeia times
This file contains 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
import re | |
from requests_html import HTMLSession | |
s = HTMLSession() | |
r = s.get('https://cbf.com.br/competicoes/brasileiro-serie-a/equipes/2018') | |
times = [x.attrs['title'] for x in r.html.find('div.cell')[0].find('a')] | |
times_renomeados = [] | |
for time in times: | |
if [x.split('-')[0] for x in times].count(time.split('-')[0]) >= 2: | |
times_renomeados.append(re.sub(r"[\ *]?-[\ *]?", "", time)) | |
else: | |
times_renomeados.append(time.split('-')[0]) | |
print(times_renomeados) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment