Answers for "make list of dicts unique"

0

python list of dictionary unique

>>> [dict(y) for y in set(tuple(x.items()) for x in d)]
Posted by: Guest on March-14-2021
-1

Create list of unique values from dictionary

dict = {'511':'Vishnu','512':'Vishnu','513':'Ram','514':'Ram','515':'sita'}
list =[] # create empty list
for val in dict.values(): 
  if val in list: 
    continue 
  else:
    list.append(val)

print list
Posted by: Guest on August-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language