as list python code example
Example 1: 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]
Example 2: python set to list
pokemon_set = set(['Pikachu', 'Bulbasaur', 'Koffing' , 'Spearow', 'Vulpix'])
print(pokemon_set)
pokemon_list = list(pokemon_set)
print(pokemon_list)
Example 3: reading a list in python
strings = list(map(str,input().split()))
numbers = list(map(int, input().split()))
Example 4: list() python
# empty list
print(list())
#-->[]
# vowel string
vowel_string = 'aeiou'
print(list(vowel_string))
#-->['a', 'e', 'i', 'o', 'u']
# vowel tuple
vowel_tuple = ('a', 'e', 'i', 'o', 'u')
print(list(vowel_tuple))
#-->['a', 'e', 'i', 'o', 'u']
# vowel list
vowel_list = ['a', 'e', 'i', 'o', 'u']
print(list(vowel_list))
#-->['a', 'e', 'i', 'o', 'u']