python remove duplicate dictionaries from a list [duplicate]

Something like this should do the stuff :

result = [dict(tupleized) for tupleized in set(tuple(item.items()) for item in l)]

first, I transform the inital dict in a list of tuples, then I put them into a set (that removes duplicates entries), and then back into a dict.

Leave a Comment