Say I have a list of dicts. I define "duplicates" as any two dicts in the list that have the same value for the "id" field (even if the other fields are different). How to remove these duplicates.
Example example:
[{'name': 'John' , 'id':1}, {'name': 'Mike' , 'id':5},{'name': 'Dan' , 'id':5}]
In this case, "Mike" and "Dan" will be duplicated, and one of them must be deleted. It doesn't matter which one.
source
share