Jul-13-2021, 09:39 AM
Hi
I have a db and i got the data and put them in python lists so I can get the records places 0,1,2...
for the first record i am able to assign the right data having the index of the first element which is [0]. Now if I click the button named next, what i can do to go to next record?
I have a db and i got the data and put them in python lists so I can get the records places 0,1,2...
for the first record i am able to assign the right data having the index of the first element which is [0]. Now if I click the button named next, what i can do to go to next record?
global thephoto global answer1 global answer2 global answer3 global answer4 global correct_answer thephoto = [] answer1 = [] answer2 = [] answer3 = [] answer4 = [] correct_answer = [] conn2 = sqlite3.connect('emsat_data.db') c2 = conn2.cursor() c2.execute("SELECT * from math_exam") conn2.commit() records = c2.fetchall() for record in records: thephoto.append(str(record[0])) answer1.append(str(record[1])) answer2.append(str(record[2])) answer3.append(str(record[3])) answer4.append(str(record[4])) correct_answer.append(str(record[5])) #how many questions are there in dbfor first records I can access calling index [0] of each list but I think this is not the right way to deal with this. Any suggestions or tutorials appreciated.