I have a list of lists, e.g [['a','b'],['c','d']].
I have a table called T and two fields F1, F2. The first item in the field list maps to F1, second to F2.
How can I insert rows for each inner list in a single command or call, rather than using a for loop like this?
for i in [['a','b'],['c','d']]:
c.execute("insert into T (F1,F2) values (%s, %s)", (i[0], i[1]))
Aucun commentaire:
Enregistrer un commentaire