python mysqldb 报错: ProgrammingError: must be real number, not str 解决
代码:
sql = 'insert into book(book_name,book_desc,origin_price,publish_id,tag_id,book_img) values(%s,%s,%d,%d,%d,%s)'
insert_data = save_df.values.tolist()
commit_data = tuple([tuple([str(x[0]),str(x[1]),float(x[2]),int(x[3]),int(x[4]),str(x[5])]) for x in insert_data]) # 执行插入语句
cursor.executemany(sql,commit_data)
# 提交插入动作
conn.commit()
执行后报错: ProgrammingError: must be real number, not str
解决:
在sql语句中把 所有的站位符 换成 %s,不用能其他的站位符。
python mysqldb 报错: ProgrammingError: must be real number, not str 解决的更多相关文章
- python 编码报错问题 'ascii' codec can't encode characters 解决方法
python在安装时,默认的编码是ascii, 当程序中出现非ascii编码时,python的处理常常会报这样的错 'ascii' codec can't encode characters pyth ...
- mac 上python编译报错No module named MySQLdb
mac 上python编译报错No module named MySQLdb You installed python You did brew install mysql You did expor ...
- 调用python脚本报错/usr/bin/env: python : No such file or directory
一.调用python脚本报错 /usr/bin/env: python: No such file or directory 二.解决方法 原因是在windows上编写的脚本,使用dos2unix对脚 ...
- 第一次打开pycharm运行python文件报错”No Python interpreter selected“问题的解决办法
前面没有细讲,这里细述一下安装pycharm后,第一次打开pycharm运行python文件报错"No Python interpreter selected"问题的解决办法. 出 ...
- MongoDB解压报错gzip: stdin: not in gzip format的解决方法
MongoDB解压报错gzip: stdin: not in gzip format的解决方法 在安装MongoDB时出现如下报错: [root@vm172--- mongodb]# tar -zxv ...
- excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法
excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法 office2007应该遇到“向程序发送命令时出现 问题”,设置为以管理员运行也不好用,重装office也不好用,下面介绍下 ...
- CocoaPods pod install的时候报错:invalid byte sequence in UTF-8 (ArgumentError)解决办法
CocoaPods pod install的时候报错:invalid byte sequence in UTF-8 (ArgumentError)解决办法: 基本可以确定是Podfile中的内容编码有 ...
- 支付宝 报错 rsa_private read error : private key is NULL解决方法
原因: 真机调试IOS支付宝功能GDB出现 rsa_private read error : private key is NULL提示 调试iOS 支付宝SDK的时候,执行demo.把 Partn ...
- 转 : Apache启动报错:could not bind to address [::]:443 解决办法
转:Apache启动报错:could not bind to address [::]:443 解决办法 安装Apache服务器的时候,报如下错误: Installing the 'apache' s ...
随机推荐
- jvm-learning-双亲委派机制
是什么 工作原理 例子 优势 什么是沙箱安全机制 其他知识 对类加载器的引用 类的主动使用和被动使用
- spring-boot-learning-监听事件
Springboot扩展了Spring的ApplicatoionContextEvent,提供了事件: ApplicationStartingEvent:框架启动事件 ApplicationEnvir ...
- Java 中 LinkedHashMap 和 PriorityQueue 的区别是 什么?
PriorityQueue 保证最高或者最低优先级的的元素总是在队列头部,但是 LinkedHashMap 维持的顺序是元素插入的顺序.当遍历一个 PriorityQueue 时,没有任何顺序保证,但 ...
- Python turtle 模块可以编写游戏,是真的吗?
1. 前言 turtle (小海龟) 是 Python 内置的一个绘图模块,其实它不仅可以用来绘图,还可以制作简单的小游戏,甚至可以当成简易的 GUI 模块,编写简单的 GUI 程序. 本文使用 tu ...
- cpu设计过程
一款CPU是如何设计出来的? 前面一段,我们了解了芯片的制造过程,也就是如何从沙子中提取硅.把硅切成片,在片上通过离子注入实现PN结.实现各种二极管.三极管.CMOS管.从而实现千万门级大规模集成电路 ...
- 3.3V转5V原理图
- CSS 面试题总结
CSS 中类 (classes) 和 ID 的区别. 书写上的差别:class名用"."号开头来定义,id名用"#"号开头来定义: 优先级不同(权重不同) 调用 ...
- 人机交互大作业--flash嵌入web(纯界面)
界面: 源代码:最近较忙,后续会上传至github
- EMS恢复禁用邮箱
使用PowerShell命令恢复禁用邮箱 键入以下命令: [PS] C:\Windows\system32>Get-MailboxDatabase | Get-MailboxStatistics ...
- 解决github上不去
github上不去 在hosts文件中加入下列IP,保存即可生效. !!!!!注意!!!!! 网站对应的IP需要去[https://www.ipaddress.com/]网站查询, 可能与下面给出的不 ...