Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python list of dictionary unique

>>> [dict(y) for y in set(tuple(x.items()) for x in d)]
Comment

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
Comment

PREVIOUS NEXT
Code Example
Python :: python string to list of chars 
Python :: how to extract zip file using python 
Python :: python import 
Python :: adding strings together in python 
Python :: python strptime milliseconds 
Python :: python serve html 
Python :: any function in python 
Python :: python merge two list 
Python :: python how to add columns to a pandas dataframe 
Python :: python check if included in list 
Python :: for char in string python 
Python :: Django rest framework update or delete 
Python :: df set index 
Python :: Django Abstract base classe 
Python :: django queryset and operator 
Python :: range() python 
Python :: matplotlib save figure without showing 
Python :: python draw tree 
Python :: python day of the year 
Python :: how to access a dictionary within a dictionary in python 
Python :: steps in for loop python 
Python :: find the sitepckages for anaconda 
Python :: How to filter words that contain atleast 2 vowels from a series 
Python :: max element in dictionary python 
Python :: index in the pool python 
Python :: developpement limité sinus python 
Python :: pyspark parquet to dataframe 
Python :: snakeviz python profile 
Python :: python code to demonstrate inheritance with animal class 
Python :: django set cookie 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =