How can i find the count of duplicates in this list.
>>> result = SiteTags.objects.values('content_type','object_id')
>>> result
[{'object_id': 1, 'content_type': 46}, {'object_id': 1, 'content_type': 46}, {'object_id': 2, 'content_type': 42}]
Is there anyway to find in query? or through an other way?
Thanks!
gives you a set of unique elements in this list. Take its length and compare it to
len(result).To get each element and its count within the result:
prints: