赞
踩
最近在使用pymysql插入数据时,会出现以下报错
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 \'det":
和
dict' object has no attribute 'translate'
最后发现是单双引号造成的问题,所以我们应该使用以下方法:
aa = pymysql.escape_string(json.dumps({"a": "b", "c": "d"}))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。