python准备stmt参数传递的问题

问题描述 投票:-1回答:1

文件C:\ Users \ User \ AppData \ Local \ Programs \ Python \ Python37 \ lib \ site-packages \ mysql \ connector \ cursor.py,第1149行,执行elif len(self._prepared [parameters])!= len (params):TypeError:int类型的对象没有len()

python parameters prepared-statement
1个回答
-1
投票

当我们传递单个参数时,问题是python make error我们需要在第一个参数的末尾加上逗号(,)。喜欢下面的

input=(customerId,)
cursor.execute(sql, input)
© www.soinside.com 2019 - 2024. All rights reserved.