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 program to switch first and second characters in a string 
Python :: get the name of a current script in python 
Python :: circular list python 
Python :: queue python 
Python :: django queryset first element 
Python :: jinja2 template import html with as 
Python :: see attributes of object python 
Python :: How to round to 2 decimals with Python? 
Python :: pyspark print a column 
Python :: python read and write pdf data 
Python :: python get architecture 
Python :: python write text file on the next line 
Python :: get a list as input from user 
Python :: python print green 
Python :: dataframe color cells 
Python :: convert np shape (a,) to (a,1) 
Python :: how to use fastapi ApiClient with pytest 
Python :: if name 
Python :: python check if list contains 
Python :: virtualenv python2 
Python :: how to setup django ionos hostig 
Python :: colors in scatter plot python 
Python :: python docx extract image 
Python :: tkinter button 
Python :: python draw rectangle on image 
Python :: pd.read_csv 
Python :: kill and run process in windows python 
Python :: get requests python 
Python :: python turtle jupyter notebook 
Python :: gspread_pandas pypi 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =