Event Timeline
Comment Actions
Quick and dirty, should use Counter class instead:
#!/usr/bin/env python3 import json from collections import defaultdict with open("query.json") as queryResultsFile: queryResults = json.load(queryResultsFile); mushers = defaultdict(int) for item in queryResults: mushers[item['musher']] += 1 for musher in [musher for musher, count in mushers.items() if count > 1]: label = '' for item in queryResults: if item['musher'] == musher: label = item['musherLabel'] print(musher, label)