gpt4 book ai didi

python - python 提供的绑定(bind)数量不正确

转载 作者:太空宇宙 更新时间:2023-11-03 17:14:30 25 4
gpt4 key购买 nike

我正在 sqllite 中执行以下查询

idP = cur.execute('SELECT id from profs where name = ?',name)

我有一个像这样的数据库表:

| id |   name   |
| 1 | xxxxxx |

但我收到错误:提供的绑定(bind)数量不正确。当前语句使用 1,并且提供了 6 个。

我认为字符串“xxxxxx”被视为六个单独的字符。

最佳答案

您可以尝试将参数转换为元组:

idP = cur.execute('SELECT id from profs where name = ?',(name,))

关于python - python 提供的绑定(bind)数量不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33768447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com