Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to create a set from a list in python

my_set = set([1, 2, 3])
my_list = list(my_set)

# By far the easiest way. 
Comment

creating a set from a list

numbers = [1, 2, 6, 3, 1, 1, 6]
unique_nums = set(numbers)
print(unique_nums)
>>>{1, 2, 3, 6}
Comment

PREVIOUS NEXT
Code Example
Python :: python md5sum 
Python :: do not show figure matplotlib 
Python :: how to print keys and values of dictionary together in python? 
Python :: get request body flask 
Python :: get last 3 in array python 
Python :: tkinter 
Python :: xml to json in python 
Python :: pandas plot date histogram 
Python :: uploading folder in google colab 
Python :: how to write a code for anagram in python 
Python :: matplotlib different number of subplots 
Python :: Python RegEx Findall – re.findall() 
Python :: pd.merge remove duplicate columns 
Python :: drop-trailing-zeros-from-decimal python 
Python :: python get current date 
Python :: multiple lines input python 
Python :: python pandas table save 
Python :: tkinter window size position 
Python :: DLL Injection in python 
Python :: not equal to in django filter 
Python :: python convert to hmac sha256 
Python :: Python Tkinter Button Widget Syntax 
Python :: how to create new header of a dataframe in python 
Python :: pickle load data 
Python :: Python of add two numbers 
Python :: how to make variable global in python 
Python :: python logging basicConfig+time 
Python :: generate rsa key python 
Python :: python math operators 
Python :: sum of a numpy array 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =