I have this code:
cursor.execute('SELECT nom FROM productes WHERE listacompra = 1')
rows = cursor.fetchall()
for row in rows:
print(row[0])
In the SQL database, I have two rows with something like this:
id 1, nom Custard, list purchase 1
id 2, nom Chocolate, listacompra 1
What I want to achieve is exactly what the previous code shows me but simply stored in one variable (like dictionaries) or in several. Taking into account that we do not know how many rows there are with shopping list = 1.
Thank you very much