Hello here is what I want to do
ListToPerm = [[1,2], [1,2,3], [1,2]]
Ouput
[1,1,1]
[1,1,2]
[1,2,1]
...
[2,3,2]
I can't seem to find anything that does this. Any answer does not do this desired output.
Hello here is what I want to do
ListToPerm = [[1,2], [1,2,3], [1,2]]
Ouput
[1,1,1]
[1,1,2]
[1,2,1]
...
[2,3,2]
I can't seem to find anything that does this. Any answer does not do this desired output.
Expanding on G.Anderson's comment that you'll want itertools.product
:
from itertools import product
l = [[1,2], [1,2,3], [1,2]]
list(product(*l))
[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (1, 3, 1), (1, 3, 2), (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2), (2, 3, 1), (2, 3, 2)]