I am trying to make a database of baseball stats and lineups. Is there a way to loop through a list of teams and use a string as an variable name?
For example: Extract t
Use dictionary:
teams = {} teams['BOS'] = team_data() teams['NYY'] = team_data() for key in teams: print(teams[key].team_name) # removed the quotes around "key"