Py学习  »  Python

无法在python sqlite中使用“ExecuteMay”更新表

Peter.k • 3 年前 • 1240 次点击  

我必须使用以下表达式更新简单表格:

cur.executemany('UPDATE earths SET population=?, density=?, tilt=?, "land area"=?, dobe=?, livity=? WHERE sid=' + str(dc['sid']) + ' AND nr=' + str(dc['nr']), v)

打印它获得的内容:

('UPDATE earths SET population=?, density=?, tilt=?, "land area"=?, dobe=?, livity=? WHERE sid=15821 AND nr=8',
 ['1360425627', '2.79', '17.33', '486857065.504', '17.88371', '0.08'])

我得到的错误是:

ProgrammingError: Incorrect number of bindings supplied. The current statement uses 6, and there are 10 supplied.

我不知道程序如何从6元素列表中看到10个值。有什么想法吗?表格正常-逐个插入数据会给出正常值。看起来

UPDATE earths SET population=1360425627, density=2.79, tilt=17.33, "land area"=486857065.504, dobe=17.88371, livity=0.08 WHERE sid=15821 AND nr=8
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/129447
 
1240 次点击  
文章 [ 2 ]  |  最新文章 3 年前