Open this example in the interactive library
Source code
teams = {'ops': ['Jo', 'Lee'], 'web': ['Lee', 'Kim']}
owners = {}
for team, names in teams.items():
for name in names:
owners.setdefault(name, []).append(team)
print(owners)
Sample output
{'Jo': ['ops'], 'Lee': ['ops', 'web'], 'Kim': ['web']}