我有一本字典(teamDictionary),其种植有名字,团队和团队成员的工作状态:与Python嵌套字典
teamDictionary = {
1: {'name': 'Bob', 'team': 'A', 'status': 'Leave'},
2: {'name': 'George', 'team': 'C', 'status': 'Training'},
3: {'name': 'Sam', 'team': 'B', 'status': 'Travel'},
4: {'name': 'Phil', 'team': 'A', 'status': 'Leave'},
5: {'name': 'Georgia', 'team': 'C', 'status': 'Training'}
}
我如何可以查询字典的解释让我能得到的名称:
- 从A队的所有队员是出在休假,或
- 从B队所有队员有能力的旅游地位,或
- 全部•来自C队的训练团队成员
在此先感谢!
你尝试过自己吗? –
我试过如果语句 - '如果teamDictionary ['team'] ==“A”和teamDictionary ['status'] =='离开':statusList = teamDictionary ['name']' – AFK
...众多其他变化,但我不断收到错误,表明字典是不可能的。 – AFK