title: Python SQLite3 / Selecting rows from table
body: <pre><code>board  balls  win1   win2   result
  -----  -----  ----   ----   ------
      1      1     0      0        1
      4      1     0      0        1
   1024      1     0      0        1
  </code></pre>
  
  <p>When we are selecting only one row but multiple columns from a table, for example, by using:</p>
  
  <pre><code>connection = sqlite3.connect("spline.db")
  crsr = connection.cursor()
  crsr.execute("SELECT board FROM positions WHERE balls = 1")
  result = crsr.fetchall()
  print result
  connection.close()
  </code></pre>
  
  <p>The result is a list of tuples:</p>
  
  <pre><code>[(1,), (4,), (1024,)]
  </code></pre>
  
  <p>Is there any way to get a list of integers directly? One way to do it is with:</p>
  
  <pre><code>print [result[i][0] for i in range(len(result))]
  </code></pre>
  
  <p>instead of with:</p>
  
  <pre><code>print result
  </code></pre>
  
  <p>But whenever that there are as much as 10<sup>7</sup> rows in the result set, we cannot imagine of iterating the variable <code>i</code> like that, and then make a list of integers out of it. So, I would like to know that if there are any other alternative solutions available for it whichever are efficient enough quite directly.</p>