title: How to Iterate through cur.fetchall() in Python
body: <p>I am working on database connectivity in Python 3.4.
  There are two columns in my database.</p>
  
  <p>Below is the query which gives me all the data from two columns in shown format
  QUERY:</p>
  
  <pre><code>cur.execute(""" select * from filehash """)
  data=cur.fetchall()
  print(data)
  </code></pre>
  
  <p>OUTPUT:</p>
  
  <pre><code>[('F:\\test1.py', '12345abc'), ('F:\\test2.py', 'avcr123')]
  </code></pre>
  
  <p>To iterate through this output, my code is as below</p>
  
  <pre><code>cur.execute(""" select * from filehash """)
  data=cur.fetchall()
  
  i=0
  j=1
  
  for i,row in data:
      print(row[i])
      print(row[j])
      i=i+1
  </code></pre>
  
  <p>This gives me below error</p>
  
  <pre><code>print(row[i])
  TypeError: string indices must be integers
  </code></pre>
  
  <p>Let me know how can we work on individual values of <code>fetchall()</code></p>