how to define dynamic nested loop python function : <pre><code>a = [1]
b = [2,3]
c = [4,5,6]

d = [a,b,c]


for x0 in d[0]:
    for x1 in d[1]:
        for x2 in d[2]:
            print(x0,x1,x2)
</code></pre>

<p>Result:</p>

<pre><code>1 2 4
1 2 5
1 2 6
1 3 4
1 3 5
1 3 6
</code></pre>

<p>Perfect, now my question is how to define this to function, considering ofcourse there could be more lists with values. The idea is to get function, which would dynamicaly produce same result.</p>

<p>Is there a way to explain to python: "do 8 nested loops for example"?</p>
