1# note: this works for two list only
2from itertools import product
3
4l1 = [1,2,3]
5l2 = [4,5,6] # works if the second list has a different lenght too
6
7product(l1, l2)
8>>> <itertools.product object at 0x7f1539c89af0>
9
10list(product(l1, l2))
11>>> [(1, 4), (1, 5), (1, 6),
12 (2, 4), (2, 5), (2, 6),
13 (3, 4), (3, 5), (3, 6)]