Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to convert a set to a list in python

my_set = set([1,2,3,4])
my_list = list(my_set)
print my_list
>> [1, 2, 3, 4]
Comment

convert list to set python

names = ['Barry', 'Alice', 'Bob', 'Bob']

unique_names = set(names)
# Result:
# {'Alice', 'Barry', 'Bob'}
Comment

python list to set

 
listOfStudents=['Mohan','John','Ramesh','Mohan','John']
print("List of Students:",listOfStudents)
uniqueNames=set(listOfStudents)
print("Set of uniqueNames:",uniqueNames)
 
listOfMarks=[8,7,6,7,8,8,7,6,7,8,9]
print("List of Makrs:",listOfMarks)
setOfMarks=set(listOfMarks)
print("Set of marks:",setOfMarks)
 
Comment

PREVIOUS NEXT
Code Example
Python :: python get local ipv4 
Python :: df astype 
Python :: Copying a list using deepcopy() in python 
Python :: tkinter icon 
Python :: get all files in pc python 
Python :: what is a framework 
Python :: online python 
Python :: python to run excel macro 
Python :: python thread stop 
Python :: mypy clear cache 
Python :: python for loop in array 
Python :: how recursion works in python 
Python :: list comprehesion python 
Python :: Program to Compute LCM 
Python :: drop portion of string in dataframe python 
Python :: automate boring stuff with python 
Python :: how to check any script is running in background linux using python 
Python :: python list object ids 
Python :: python string cut first n characters 
Python :: python delete all occurrences from list 
Python :: remove part of string python 
Python :: check if list is empty python 
Python :: convert string to lowercase in python 
Python :: how to type using selenium python 
Python :: how to show mean values on histogram in seaborn 
Python :: write list to csv python 
Python :: install simple audio in python 
Python :: python tkinter entry widget 
Python :: hungry chef solution 
Python :: associate keys as list to values in python 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =