want to store elements in array or list using python
<p>I am learning python. I want to store one by one element in array or list.
this is my code.      </p>

<pre><code>for u in durl:
      p2 = requests.get(u)
      tree = html.fromstring(p2.content)
      dcode.append = tree.xpath(ecode)
      print(dcode)
</code></pre>

<p>in dcode variable the elements are overriding not appending.
i want to insert it one by one.
please help me.  </p>

<p><code>tree.xpath(...)</code> returns a list so if you want to merge it with an existing list <code>dcode</code> of selected elements, you might do</p>

<pre><code>dcode.extend(tree.xpath(ecode))
</code></pre>

python arrays list python-2.7