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