代码:

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 解决的更多相关文章

  1. python 编码报错问题 'ascii' codec can't encode characters 解决方法

    python在安装时,默认的编码是ascii, 当程序中出现非ascii编码时,python的处理常常会报这样的错 'ascii' codec can't encode characters pyth ...

  2. mac 上python编译报错No module named MySQLdb

    mac 上python编译报错No module named MySQLdb You installed python You did brew install mysql You did expor ...

  3. 调用python脚本报错/usr/bin/env: python : No such file or directory

    一.调用python脚本报错 /usr/bin/env: python: No such file or directory 二.解决方法 原因是在windows上编写的脚本,使用dos2unix对脚 ...

  4. 第一次打开pycharm运行python文件报错”No Python interpreter selected“问题的解决办法

    前面没有细讲,这里细述一下安装pycharm后,第一次打开pycharm运行python文件报错"No Python interpreter selected"问题的解决办法. 出 ...

  5. MongoDB解压报错gzip: stdin: not in gzip format的解决方法

    MongoDB解压报错gzip: stdin: not in gzip format的解决方法 在安装MongoDB时出现如下报错: [root@vm172--- mongodb]# tar -zxv ...

  6. excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法

    excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法 office2007应该遇到“向程序发送命令时出现 问题”,设置为以管理员运行也不好用,重装office也不好用,下面介绍下 ...

  7. CocoaPods pod install的时候报错:invalid byte sequence in UTF-8 (ArgumentError)解决办法

    CocoaPods pod install的时候报错:invalid byte sequence in UTF-8 (ArgumentError)解决办法: 基本可以确定是Podfile中的内容编码有 ...

  8. 支付宝 报错 rsa_private read error : private key is NULL解决方法

    原因:  真机调试IOS支付宝功能GDB出现 rsa_private read error : private key is NULL提示 调试iOS 支付宝SDK的时候,执行demo.把 Partn ...

  9. 转 : Apache启动报错:could not bind to address [::]:443 解决办法

    转:Apache启动报错:could not bind to address [::]:443 解决办法 安装Apache服务器的时候,报如下错误: Installing the 'apache' s ...

随机推荐

  1. django模板之forloop

    在django的模板中,有forloop这一模板变量,颇似php Smarty中的foreach.customers, Smarty foreach如下: {foreach name=customer ...

  2. 一个 Spring 的应用看起来象什么?

    一个定义了一些功能的接口.这实现包括属性,它的 Setter , getter 方法和函数等.Spring AOP.Spring 的 XML 配置文件.使用以上功能的客户端程序.

  3. 学习Redis(一)

    一.NoSQL 1.NoSql介绍 1.not only SQL,非关系型数据库,它能解决常规数据库的并发.IO与性能的瓶颈 2.解决以下问题: ① 对数据库的高并发读写需求 ② 大数据的高效存储和访 ...

  4. 运筹学之"概率"和"累计概率"和"谁随机数"

    概率 = 2/50 = 0.2 累计概率 = 上个概率加本次概率 案例1 概率=销量天数 / 天数 = 2 /100 = 0.02 累计概率 = 上个概率加本次概率 = 0.02 +0.03 = 0. ...

  5. 时间工具类之“ JDK1.8中 LocalDate、LocalTime、LocalDateTime、LocalDateTimeUtil四个时间工具类”

    一.使用的原因 在JDK8发布的时候,推出了LocalDate.LocalTime.LocalDateTime这个三个时间处理类,以此来弥补之前的日期时间类的不足,简化日期时间的操作. 在Java8之 ...

  6. Vue报错之"[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead......"

    一.报错截图 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the p ...

  7. 巧用CSS3:target 伪类制作Dropdown下拉菜单(无JS)

    原文链接:http://devework.com/css3-target-dropdown.html :target 是CSS3 中新增的一个伪类,用以匹配当前页面的URI中某个标志符的目标元素(比如 ...

  8. window10解决需要管理员删除文件的权限问题

    1.快捷键:"win+R",输入:gpedit.msc  回车 2.依次点击:计算机配置-windows配置-安全设置-本地策略-安全选项 3.将两个管理员批准模式和管理员状态三者 ...

  9. JavaScript 中 empty、remove 和 detach的区别

    内容 empty.remove 和 detach的区别 jQuery 操作 DOM 之删除节点 方法名 元素所绑定的事件及数据是否也被移除 作用 $(selector).empty() 是 从被选元素 ...

  10. JavaScript面向对象的方式开发轮播图插件

    轮播图是很多页面必不可少的组件.这里来使用面向对象方式开发一个插件.减去开发的痛楚 首先需要寻找对象:只有一个对象,轮播图!关键点在于找到这个对象所拥有的属性以及方法,通过代码实现出来,这是面向对象最 ...