I have a list of dicts, and I\'d like to remove the dicts with identical key and value pairs.
For this list: [{\'a\': 123}, {\'b\': 123}, {\'a\': 123}]<
[{\'a\': 123}, {\'b\': 123}, {\'a\': 123}]
Not so short but easy to read:
list_of_data = [{'a': 123}, {'b': 123}, {'a': 123}] list_of_data_uniq = [] for data in list_of_data: if data not in list_of_data_uniq: list_of_data_uniq.append(data)
Now, list list_of_data_uniq will have unique dicts.
list_of_data_uniq