我有一个字典列表,现在我正在尝试查找每个远程标识符的总工作量。
在这种情况下,我期望id为
在这种情况下,我期望id为
64 -> 11 jobs
和68 -> 0 jobs
。[{
'jobs': {
'count': 4
},
'remote_identifier': {
'id': '64'
}
}, {
'jobs': {
'count': 0
},
'remote_identifier': {
'id': '68'
}
}, {
'jobs': {
'count': 7
},
'remote_identifier': {
'id': '64'
}
}]
我已经尝试过类似的方法,但我不知道如何根据我的需求进行调整,因为那只是计算出现次数。
from collections import Counter
print Counter(item['remote_identifier']['id'] for item in items )