-
-
Save FRC5414/9e65adaa959c396993d19bedf722693b to your computer and use it in GitHub Desktop.
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 tbapy | |
import csv | |
tba = tbapy.TBA('getaTBAkey') | |
teams = tba.teams() | |
rows = [] | |
state = 1 | |
for i in teams: | |
years = tba.team_years(i.team_number) | |
# print(i.team_number) | |
if i.team_number > (state * 100): | |
print(state * 100) | |
state += 1 | |
try: | |
started = years[0] | |
last = years[-1] | |
if len(years) != (last - started + 1): | |
for j in range(len(years)): | |
if years[j+1] > years[j] + 1: | |
last = years[j] | |
returned = years[j+1] | |
break | |
else: | |
returned = 0 | |
row = [i.team_number, started, last, returned] | |
except: | |
print(".", end="") | |
rows.append(row) | |
with open("teamData.csv", 'w', newline='') as csvfile: | |
writer = csv.writer(csvfile, delimiter=",") | |
writer.writerows(rows) | |
print("Done!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment