Jul-15-2021, 08:25 AM
Hi,
I am trying to get a field from db which is a text but when trying to print it it gives me in form of list. how to print the value as string instead!
I am trying to get a field from db which is a text but when trying to print it it gives me in form of list. how to print the value as string instead!
conn = sqlite3.connect('emsat_data.db') c = conn.cursor() c.execute("SELECT candidate_answer from candidate_math_answers where exam_photo=?", (thephoto[count - 1],)) conn.commit() records = c.fetchall() theanswer=str(records[0]) conn.close() print(theanswer)note that the number of records is one record only that is why it is not in loop. When I try this code I get:
Quote:('A. 2',)and what I want is
Quote:A. 2