One way is to use FrozenDict
. By using this, you may perform set like operation on your dict
. But this not available as default python package.
Alternatively, Make entry from your list to new list and make a check before entering the new value. Below is the sample code:
my_list = [{'date': '08/11/2016', 'duration': 13.0}, {'date': '08/17/2016', 'duration': 5.0}, {'date': '08/01/2016', 'duration': 5.2}, {'date': '08/11/2016', 'duration': 13.0}, {'date': '08/11/2016', 'duration': 13.0}, {'date': '08/11/2016', 'duration': 13.0}]
new_list = []
for item in my_list:
if item not in new_list:
new_list.append(item)
# new_list = [{'date': '08/11/2016', 'duration': 13.0}, {'date': '08/17/2016', 'duration': 5.0}, {'date': '08/01/2016', 'duration': 5.2}]