从《MySQLdb用户指南》中:
c.executemany( """INSERT INTO breakfast (name, spam, eggs, sausage, price) VALUES (%s, %s, %s, %s, %s)""", [ ("Spam and Sausage Lover's Plate", 5, 1, 8, 7.95 ), ("Not So Much Spam Plate", 3, 2, 0, 3.95 ), ("Don't Wany ANY SPAM! Plate", 0, 4, 3, 5.95 ) ] )
所以在你的情况下:
c.executemany("insert into T (F1,F2) values (%s, %s)", [('a','b'),('c','d')])
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)