I have a dict list where a specific value is repeated several times, and I would like to remove duplicate values.
My list:
te = [ { "Name": "Bala", "phone": "None" }, { "Name": "Bala", "phone": "None" }, { "Name": "Bala", "phone": "None" }, { "Name": "Bala", "phone": "None" } ]
to remove duplicate values:
def removeduplicate(it): seen = set() for x in it: if x not in seen: yield x seen.add(x)
When I call this function, I get a generator object .
<generator object removeduplicate at 0x0170B6E8>
When I try to TypeError: unhashable type: 'dict' over the generator, I get TypeError: unhashable type: 'dict'
Is there a way to remove duplicate values ββor iterate over the generator
source share