2
I have the following structure of INSERT
to the database POSTGRES:
for first in nomes:
for second in quantidades:
for third in produtos:
cursor.execute(first,second,third,str(timestampInitial))
PROBLEM
It is entering an infinite looping, which runs several times the same value as the first loop
I would like to insert the lists nomes, quantidades e produtos
and a single INSERT in the same database table, what is the correct way to perform this operation in python ?
How are these lists?
– Woss
Example: names = [u'CARLOS',u'LUIS',u'JUNIOR']
– Luis Henrique
Example: quantities = ['1','2','3']
– Luis Henrique
Need to understand better what you need, you want to enter all values from a list for all values from the other lists ? example : 0 0 0 / 0 0 1 / 0 0 2 / 0 1 0 or you need each index of your lists to be inserted with its equivalent index of another list ? example : 0 0 0 / 1 1 1 / 2 2 2 ?
– Filipe Gonçalves
I need it to be like this: 0 0 0 / 1 1 1 / 2 2 the zip() method, solved the problem, thank you very much!
– Luis Henrique