MySQL 保存tuple类型_使用Python插入多个MySQL记录。错误:“Python'tuple'无法转换为MySQL类型”...

使用Python插入多个MySQL记录

错误:Python“tuple”无法转换为MySQL类型

错误代码:

python python_mysql_2.py

回溯(最近一次呼叫):

文件“C:\Users\POM\AppData\Local\Programs\Python37-32\lib\site packages\mysql\connector\转换.py“,第181行,在tou mysql中

return getattr(self,“{0}u to_mysql”.format(type_name))(value)

AttributeError:“MySQLConverter”对象没有属性“tuple”to“u mysql”During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\cursor.py", line 432, in _process_params

res = [to_mysql(i) for i in res]

File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\cursor.py", line 432, in

res = [to_mysql(i) for i in res]

File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\conversion.py", line 184, in to_mysql

"MySQL type".format(type_name))

TypeError: Python 'tuple' cannot be converted to a MySQL type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "python_mysql_2.py", line 22, in

my_cursor.execute(mike_placeholders,records_list)

File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\cursor.py", line 557, in execute

psub = _ParamSubstitutor(self._process_params(params))

File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\cursor.py", line 437, in _process_params

"Failed processing format-parameters; %s" % err)

mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python 'tuple' cannot be converted to a MySQL type

Python代码:

^{pr2}$

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值