I\'m trying to figure out the best way to merge two lists into all possible combinations. So, if I start with two lists like this:
list1 = [1, 2] list2 = [3,
The accepted answer can be simplified to
a = [1, 2, 3] b = [4, 5, 6] [list(zip(a, p)) for p in permutations(b)]
(The list() call can be omitted in Python 2)