如何使用executemany在MySQL中插入Python字典列表

如何使用executemany在MySQL中插入Python字典列表,第1张

如何使用executemany在MySQL中插入Python字典列表
itemBank = [] for row in rows:    itemBank.append((        tempRow2['Item_Name'],        tempRow1['Item_Price'],        tempRow3['Item_In_Stock'],        tempRow4['Item_Max'],         getTimeExtra        )) #append dataq = """ insert ignore into TABLE1 (        Item_Name, Item_Price, Item_In_Stock, Item_Max, Observation_Date )         values (%s,%s,%s,%s,%s)    """try:    x.executemany(q, itemBank)    conn.commit()except:    conn.rollback()

希望对您有帮助



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5043340.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-15
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存