代码:

sql = "insert into dm_copy(演出类型,演出场馆,剧目名称,演出地点,演出时间,演出票价,演出团体,创建时间, url)values('%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (category, venue, name, city, showtim, prices[:-1], actor, Creation_time, p_url)

问题是:

pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tWe','2018/07/09 09:33','https://piao.damai.cn/155901.html')' at line 1")

原因可能是actor值

   有引号

解决方式

pymysql.escape_string()

代码:

sql = "insert into dm_copy(演出类型,演出场馆,剧目名称,演出地点,演出时间,演出票价,演出团体,创建时间, url)values('%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (category, venue, name, city, showtim, prices[:-1], pymysql.escape_string(actor), Creation_time, p_url)

 

pymysql.err.ProgrammingError: (1064)(字符串转译问题)的更多相关文章

  1. pymysql.err.ProgrammingError: 1064 (Python字符串转义问题)

    代码: sql = """INSERT INTO video_info(video_id, title) VALUES("%s","%s&q ...

  2. sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError)

    在我学习flask建立网站时间碰到了一个棘手的问题,就是在我进行操作日志的更新时间,发现表格建立有点错误,导致表缺失,从而报了下面的错误 sqlalchemy.exc.ProgrammingError ...

  3. pymysql.err.InternalError: (1054, "Unknown column 'None' in 'field list'")

    错误提示: Traceback (most recent call last): File "D:/projectwc/test/dd.py", line 43, in <m ...

  4. 解决pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9F\\x8C\\xB8' for column 'headline' at row 1")

    解决pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9F\\x8C\\xB8' for column ...

  5. 报错pymysql.err.DataError: (1406, "Data too long for column 'gender' at row 1")

    在Django默认的admin后台创建超级用户时, 报错pymysql.err.DataError: (1406, "Data too long for column 'gender' at ...

  6. pymysql.err.InternalError: (1205, 'Lock wait timeout exceeded; try restarting transaction')错误处理

    问题描述: 在使用pymysql库时,利用游标执行插入操作,产生错误,会出现pymysql.err.InternalError: (1205, 'Lock wait timeout exceeded; ...

  7. mysql修改字段长度及pymysql.err.DataError: (1406, "Data too long for column 'name' at row 1")错误

    文章链接:修改字段:https://blog.csdn.net/xiejunna/article/details/78580682 错误分析:https://blog.csdn.net/qq_4214 ...

  8. pymysql.err.InterfaceError: (0, '')解决办法

    导致这个错误的原因是通过pymysql连接MySQL,没有关闭连接的操作,所以短时间内不会出问题,长时间保持这个连接会出现连接混乱.虽然看着自己的代码没错,还是会报 pymysql.err.Inter ...

  9. MySQL数据库报错pymysql.err.InterfaceError: (0, '')

    今天入库的时候出现了报错pymysql.err.InterfaceError: (0, ''),经过排查,发现是由于把连接数据库的代码放到了插入函数的外部,导致多线程运行出错 def write_in ...

随机推荐

  1. Spring MVC-控制器(Controller)-可参数化视图控制器(Parameterizable View Controller )示例(转载实践)

    以下内容翻译自:https://www.tutorialspoint.com/springmvc/springmvc_parameterizableviewcontroller.htm 说明:示例基于 ...

  2. PHP包管理工具composer简单总结

    前言 接触laravel之后,才知道有PSR,composer之类的东西,PHP已经不再是一门草根语言了.最近在尝试玩thrift,需要安装PHP thrift依赖库,使用composer insta ...

  3. systemtap dtrace与 oracle

    https://fritshoogland.wordpress.com/page/3/ http://externaltable.blogspot.com/2013/06/dtrace-explora ...

  4. iOS: 两句话给UILabel添加下划线

    1. 将UILabel控件的Text属性设为Attributed 2. 在viewDidLoad方法中添加如下语句: NSDictionary *underlineAttribute = @{NSUn ...

  5. poj 1635

    有根树同构.参考论文<hash在....> #include <iostream> #include <fstream> #include <algorith ...

  6. mysql 日期计算,今天,明天,本周,下周,本月,下月

    --今天 DATE_FORMAT(BIRTH_DATE,'%Y-%m-%d') = CURDATE() --明天 DATE_FORMAT(BIRTH_DATE,'%Y-%m-%d') = TIMEST ...

  7. nyoj--990--蚂蚁感冒(模拟)(思维题)

    蚂蚁感冒 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述 长100厘米的细长直杆子上有n只蚂蚁.它们的头有的朝左,有的朝右. 每只蚂蚁都只能沿着杆子向前爬,速度是1厘米/ ...

  8. bzoj 4198 [ Noi 2015 ] 荷马史诗 —— 哈夫曼编码(k叉哈夫曼树)

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4198 第一次写哈夫曼树!看了很多博客. 哈夫曼树 & 哈夫曼编码:https://w ...

  9. @RequestBody接收的是一个json对象

    一直以为在SpringMVC环境中,@RequestBody接收的是一个json对象,调试代码时没有成功,后来才发现,其实 @RequestBody接收的是一个json字符串,而不是一个json对象. ...

  10. flash 遮住 div 解决办法

    被遮盖的div 下面的代码   <!--列表菜单-->             <div id="opreationmenu" style="posit ...