Nov-18-2018, 04:22 PM
You could load your dictionary in a loop. If your team_stats list is just a list of sub-lists of the form [team_name, strength, form, injuries, motivation, city], it would look like this
dict_teams = {} for team in team_stats: dict_teams[team[0]] = Teams(*team)The *team syntax turns the list in a series of parameters to the Team instance. The above loop can be turned into a dictionary comprehension:
dict_teams = {team[0]: Teams(*team) for team in team_stats}