python向数据库传输数据时弹出not enough arguments for format string怎么办
生活随笔
收集整理的這篇文章主要介紹了
python向数据库传输数据时弹出not enough arguments for format string怎么办
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
cursor.executemany 為批量操作,批量就是一次能寫(xiě)入多行數(shù)據(jù)
傳入cursor.executemany(sql, values)的values參數(shù),應(yīng)是多行的,即 [(一組數(shù)據(jù)),(另一組數(shù)據(jù))]
如果直接傳入的是 (一行數(shù)據(jù)) ,則不符合參數(shù)格式要求 ,提示not enough arguments for format string
應(yīng)該修改為vales=[(一組數(shù)據(jù))],或者直接用單行操作:cursor.execute(sql,values)。
與50位技術(shù)專家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖
總結(jié)
以上是生活随笔為你收集整理的python向数据库传输数据时弹出not enough arguments for format string怎么办的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: python没有代码提示怎么设置_Pyt
- 下一篇: python如何装sklearn_pyt