我正试图在MySqlDB
中保存一堆元组。
cursor = cnx.cursor()
query = """INSERT INTO `TableA`
(`clientid`,
`createddatetime`,
`siteid`,...)
VALUES(%s,%s,%s,...)"""
cursor.executemany(query, listTosave)
我的listTosave
就像:
[('AS0001', '1170', '1', '1', 'Unknown', '442', '1', '2018-05-28 23:00:00', '2018-03-15 11:15:00', '2018-03-15 10:56:00', '2018-05-28 23:18:26', '2018-05-28 23:59:22', '15177.3184', '15185.7562', '8.4378', '1313.0547', '1313.6179', '0.5632', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '24.6518', '24.6518', '15101.7062', '0.0', '0.0', '0.0', '24.6563'), (.....)]
执行时,我
cursor.executemany(query , listTosave)
File "/tmp/pymodules/pymysql/cursors.py", line 192, in executemany
File "/tmp/pymodules/pymysql/cursors.py", line 208, in _do_execute_many
TypeError: not enough arguments for format string
我在这里做错了什么?
P.S:
TypeError: not all arguments converted during string
在这里问了一个问题:
TypeError: not all arguments converted during string formatting Error in tuple python