I have an empty list contacts = []. I also have a sqlite3 database, with each row containing first_name, last_name, email, phone_number, address for a person. I want to populate my empty contacts list with a list [first_name, last_name, email, phone_number, address] for each individual/row in the database.
The way I am thinking to do it is doing
tempvar = cursor.fetchall()
rowcount = len(tempvar)
to get the number of rows in the database, to be used in a for loop as such:
for n in range(0, rowcount):
contacts.append([a,
b,
c,
d,
e])
but I want a b c d and e to be queries for first_name, last_name, email, phone_number, and address of the nth person. Can someone help me fill in the blank? Hopefully I am making sense!
tempvar?