Answers for "convert set to array python"

1

convert array to set python

# Simple example:

list_ex = [1, 2, 3, 4]
list_set = set(list_ex)

# Printing the newly-created set should yield the following result:
# {1, 2, 3, 4}

# If you have a matrix (list of lists), you can convert 
# it to a set by following this example:
matrix_ex = [[1, 2], [3, 4], [5, 6]]
matrix_set = {e for l in matrix_ex for e in l}
Posted by: Guest on July-19-2021
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

Code answers related to "convert set to array python"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language