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 ...
随机推荐
- 说说对 SQL 语句优化有哪些方法?(选择几条)
1.Where 子句中:where 表之间的连接必须写在其他 Where 条件之前,那些可 以过滤掉最大数量记录的条件必须写在 Where 子句的末尾.HAVING 最后. 2.用 EXISTS 替代 ...
- javax.net.ssl.sslhandshakeException:sun.security.validator.validatorException:PKIX path buildind failed
前段时间开发的一个需求,需要通过图片URL获取图片的base64编码,测试的时候使用的是百度图片的url,测试没有问题,但是发布后测试时报如下错: javax.net.ssl.sslhandshake ...
- java-规约-OOP
public class OOP { /** * 避免通过一个类的对象引用访问此类的静态变量或者静态方法 * 直接通过类名去访问 */ // 错误使用例子: public static void ma ...
- Java 中如何实现序列化,有什么意义?
序列化就是一种用来处理对象流的机制,所谓对象流也就是将对象的内容进行流 化.可以对流化后的对象进行读写操作,也可将流化后的对象传输于网络之间. 序列化是为了解决对象流读写操作时可能引发的问题(如果不进 ...
- Netty学习摘记 —— ByteBuf详解
本文参考 本篇文章是对<Netty In Action>一书第五章"ByteBuf"的学习摘记,主要内容为JDK 的ByteBuffer替代品ByteBuf的优越性 你 ...
- Visual Studio App Center 中的 Bug 跟踪服务
我在之前的一篇文章 <使用 Visual Studio App Center 持续监视应用使用情况和问题> 中介绍了 App Center 的基本功能及使用入门,其中 诊断 可以自动手机用 ...
- k-medoids算法
k-medoids算法 对上面图形的解释 第一幅图:原来p属于Oj的(实线),当Orandom代替了Oj,p属于Oi了(虚线):第二幅图:原来p属于Oj的(实线),当Orandom代替了Oj,p属于O ...
- SQL之总结(一)
导游通项目之总结SQL 1.选择前面的某几个 oracle: select * from tb_article where rownum<5 order by article_id ...
- 软件构造实验-百度图像识别api
识别结果: 识别结果:
- java中String类的用法
1.String String类很常用,很重要. String不像int或float, 它是参考类型.final类型, 不能被继承,String is a Reference Type,Defined ...