I have a dictionary that looks like this:
{'Week 1': {'Game1': {'Away': 'Team3', 'Home': 'Team2', 'Venue': 5},
'Game2': {'Away': 'Team1', 'Home': 'Team4', 'Venue': 6}},
'Week 2': {'Game1': {'Away': 'Team1', 'Home': 'Team2', 'Venue': 4},
'Game2': {'Away': 'Team4', 'Home': 'Team3', 'Venue': 1}},
'Week 3': {'Game1': {'Away': 'Team1', 'Home': 'Team3', 'Venue': 6},
'Game2': {'Away': 'Team2', 'Home': 'Team4', 'Venue': 4}}
...}
The dictionary contains fixture seperated by 'Week', 'Game' then 'Home', 'Away' and 'Venue'.
Say I was looking to search for all fixtures for 'Team 1' from the dictionary above and get an output of:
{'Week 1': {'Game 2': {'Away: ': 'a', 'Home: ': 'd', 'Rink ': 6}},
'Week 2': {'Game1': {'Away: ': 'a', 'Home: ': 'b', 'Rink ': 4}},
'Week 3': {'Game1': {'Away: ': 'a', 'Home: ': 'c', 'Rink ': 6}}}
What would be the best way to do this?
I've tried using for loops
for week, games in dict:
for game, details in games:
for k, v in details:
if v == 'Team1'
newDict.update({week: {game: details}})
But i get ValueError: too many values to unpack
Am I on the right lines, or totally off base? Any help would be greatly appreciated