Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

cartesian product of a list python

import itertools

somelists = [
   [1, 2, 3],
   ['a', 'b'],
   [4, 5]
]
for element in itertools.product(*somelists):
    print(element)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cartesian #product #list #python
ADD COMMENT
Topic
Name
2+3 =