Answers for "how to convert a set to a list in python"

7

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]
Posted by: Guest on May-19-2020
9

convert list to set python

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

unique_names = set(names)
# Result:
# {'Alice', 'Barry', 'Bob'}
Posted by: Guest on April-08-2020
7

python set to list

pokemon_set = set(['Pikachu', 'Bulbasaur', 'Koffing' , 'Spearow', 'Vulpix'])
print(pokemon_set)
pokemon_list = list(pokemon_set)
print(pokemon_list)
Posted by: Guest on August-09-2020

Code answers related to "how to convert a set to a list in python"

Python Answers by Framework

Browse Popular Code Answers by Language