Build a single list of element from bi-dimensional array list
<p>I'm totally noob to python so please forgive my mistake and lack of vocabulary. Long Story Short, I have the following list of array :</p>

<pre><code>[url1, data1][url2, data2][url3, data3]etc...
</code></pre>

<p>I want to build a simple list of element by only keeping the url. So I'm doing this :</p>

<pre><code>  if results:
    for row in results.get('rows'):
      data.append(row[:1])
    print data
</code></pre>

<p>for this result:</p>

<pre><code>[[url1][url2][url3]etc...]
</code></pre>

<p>However I would like to have something like this :</p>

<pre><code>[[url1, url2, url3,etc...]
</code></pre>

<p>I've imported numpy and tried this but doesn't work :</p>

<pre><code>np.array(data).tolist()
</code></pre>

<p>Any help ?  </p>

<p>thanks.</p>

<p>If I understood you correctly, you need this:</p>

<pre><code>results = [[url_1, data_1], [url_2, data_2], ...]
urls = list()
for r in results:
    # r = [url_i, data_i]
    urls.append(r[0])
</code></pre>

python arrays