on-internet
← Community

How do I pull truly unique dictionaries from a list of dictionaries in Python?

Stack Overflow ·

Say I have a list of dictionaries {'key1': 'a', 'key2': 'b'} {'key1': 'a', 'key2': 'b'} {'key1': 'c', 'key2': 'b'} {'key1': 'a', 'key2': 'c'} If there are any dictionaries in the list that are not truly unique (there is not another dictionary that is exactly like it), I want to remove all of those dictionaries for an output of {'key1': 'c', 'key2': 'b'} {'key1': 'a', 'key2': 'c'} What would be the best way to do this?

Comments

Sign in or sign up to comment and upvote.

No comments yet.