Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

find all unique items in dictionary value python

L = [{"V":"S001"}, {"V": "S002"}, {"VI": "S001"}, {"VI": "S005"}, {"VII":"S005"}, {"V":"S009"},{"VIII":"S007"}]
print("Original List: ",L)
u_value = set( val for dic in L for val in dic.values())
print("Unique Values: ",u_value)
Comment

print all unique values in a 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

how to find unique values in list in python

mylist = ['nowplaying', 'PBS', 'PBS', 'nowplaying', 'job', 'debate', 'thenandnow']
myset = set(mylist)
print(myset)
Comment

PREVIOUS NEXT
Code Example
Python :: python pause 
Python :: OneHotEncoder sklearn python 
Python :: python google search results 
Python :: How to find majority element in a sequence of values using Boyer-Moore vote algorithm? 
Python :: captain marvel subtitles subscene 
Python :: error warning tkinter 
Python :: insert video in tkinter 
Python :: number of columns with no missing values 
Python :: python get size of file 
Python :: plt close all 
Python :: python discord how to get user variables 
Python :: how to empty a text file in python 
Python :: how to create a file in a specific location in python 
Python :: save dataframe as csv 
Python :: append row to array python 
Python :: python writelines newline 
Python :: cross validation python 
Python :: python little endian to big endian 
Python :: apply strip() a column in pandas 
Python :: select text in a div selenium python 
Python :: make beep python 
Python :: python create 2d array deep copy 
Python :: python download file from web 
Python :: python gtts 
Python :: python selenium assert presence of an element 
Python :: fill na with mode and mean python 
Python :: convert birth date to age pandas 
Python :: where my python modules 
Python :: all characters python 
Python :: discordpy 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =