cartesian product of a list python

66

cartesian product of a list python -

import itertools

somelists = [
   [1, 2, 3],
   ['a', 'b'],
   [4, 5]
]
for element in itertools.product(*somelists):
    print(element)

Comments

Submit
0 Comments