Answer the question
In order to leave comments, you need to log in
How to list all elements of a specific sqlite3(python) database column?
I have a database that has all values entered correctly. I write this code in python:
checkers_subject_list = checkers_db_script.get_checkers_id(subject)
for key in checkers_subject_list:
print(key)
import sqlite3
def get_checkers_id(subject):
conn = sqlite3.connect("checkers_list.db")
c = conn.cursor()
c.execute(f"SELECT checker_id FROM checkers WHERE subject = '{subject}'")
return c.fetchall()
Answer the question
In order to leave comments, you need to log in
The author knows that fetchall returns a list, now it's time for the author to know that the elements of this list are tuples. It remains to read the basics of python and learn how to work with this data type.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question