passing items from list to an empty object in another list
<p>I want to pass items from lists to the empty object in store i.e. I want:</p>

<pre><code>store = [ [['a', 'b'], ['c', 'd']], [] ]
</code></pre>

<p>I am getting an unintended result: </p>

<pre><code>lists = [['a', 'b'], ['c', 'd']]

store = [[], []]


counter = 0
for l in lists:
    for s in store:
        s.append(l)
</code></pre>

<p>which gives me:</p>

<pre><code>store = [[['a', 'b'], ['c', 'd']], [['a', 'b'], ['c', 'd']]]
</code></pre>

<p>If </p>

<pre><code>store = [ [['a', 'b'], ['c', 'd']], [] ]
</code></pre>

<p>is indeed what you want, then you've overshot the mark. The inner loop is unnecessary and will execute your code for <em>each</em> item in <code>store</code>. You have two empty lists in <code>store</code>, thus creating two populated lists in <code>store</code> after the code has run. To just do the first one, you want</p>

<pre><code>for l in lists:
    store[0].append(l)
</code></pre>

<p>Reading your question though I'm not 100% positive that's what you're actually after, esp. given your otherwise mysterious inner loop.</p>

<p>I read "I want to pass items from lists to the empty object in store" as possibly meaning you're trying to take items from two lists in <code>lists</code> and make them one list in <code>store</code>. If that's what you want, something like this would do the trick:</p>

<pre><code>for l in lists:
    for i in l:
        store[0].append(i)
</code></pre>

<p>which gives you:</p>

<pre><code>[['a', 'b', 'c', 'd'], []]
</code></pre>

python list nested-loops