|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
db = pymysql.connect(host='localhost', port=3308, user='root', password='', database='pacong', charset='utf8')
cur = db.cursor()
sql_1 = 'SELECT * FROM 5.29 WHERE target = %s' # 这句话的引号部分有问题 为什么换成baidunews就没问题呢?是不是库名有汉字就不行?
cur.execute(sql_1, target)
以上是部分指令
运行之后在这个地方报错了,也就是字符串target拼接进去之后无缘无故右边自己多了一个引号,不知道怎么去,有没有大佬处理过这类问题的,csdn上的方法试过了,没有效果教教我!
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 '5.29 WHERE target = '中南财经政法大学'' at line 1") |
|