python准备的stmt参数传递问题 [英] Problem with python prepared stmt parameter passing

查看:78
本文介绍了python准备的stmt参数传递问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

File C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\mysql\connector\cursor.py, line 1149, in execute elif len(self._prepared[parameters]) != len(params): TypeError: object of type int has no len()

推荐答案

问题是当我们传递单个参数时需要将逗号(,)传递给python make错误. 在第一个参数的末尾.像下面这样

The problem is python make error when we pass single parameter we need to put comma(,) at the end of first parameter. like the follwoing

input=(customerId,)
cursor.execute(sql, input)

这篇关于python准备的stmt参数传递问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆