Making Combination from lists using itertools
<pre><code>import itertools
a = [[2, 3], [3, 4]]
b = [[5, 6], [7, 8], [9, 10]]
c = [[11, 12], [13, 14]]
d = [[15, 16], [17, 18]]
e = [[12,16],[13,17],[14,18],[15,19]]

q=[]
q=list(itertools.combinations((a, b, b,c, c, d,e),7)
print q
</code></pre>

<p>How would I go about using the combination function from itertools properly to use list a one time, b 2 times without replacement, c 2 times without replacement, and d and e one time each?</p>

<pre><code>[[[2, 3],[5, 6],[7, 8],[11, 12],[13, 14],[15, 16],[12,16]], 
[[2, 3],[5, 6],[7, 8],[11, 12],[13, 14],[15, 16],[13,17]],
[[2, 3],[5, 6],[7, 8],[11, 12],[13, 14],[15, 16],[14,18]],
[[2, 3],[5, 6],[7, 8],[11, 12],[13, 14],[15, 16],[15,19]], 
[[2, 3],[5, 6],[7, 8],[11, 12],[13, 14],[15, 16],[12,16]],...
[[3, 4],[7, 8],[9, 10],[11, 12], [13, 14],[17, 18],[15,19]]]
</code></pre>

<p><strong>Updated given clarification of expected output</strong>:</p>

<p><a href="https://docs.python.org/3/library/itertools.html#itertools.product" rel="nofollow">You want <code>itertools.product</code></a>:</p>

<pre><code>itertools.product(a, b, b, c, c, c, c, d, e)
</code></pre>

<p>Which will pick one element from each of its arguments on each iteration, cycling the rightmost element the fastest, leftmost slowest.</p>

<p>You can use extended argument unpacking to express the repetition of certain arguments a little more obviously in Python 3:</p>

<pre><code>itertools.product(a, *[b]*2, *[c]*4, d, e)
</code></pre>

<p>Or use <a href="http://stackoverflow.com/a/39520252/364696">tobias_k's solution</a> for more general repetition of sequences (that will also work on Py2).</p>

python list combinations itertools