我们知道python3.x引入了新的字符串格式化语法。不同于python2.x的
代码如下:
"%s %s "%(a,b)
代码如下:
"{0} {1}".format(a,b)
代码如下:
cursor.execute(sql,param)
代码如下:
cursor.execute('insert into test values(%s,%s,%s)',param)
代码如下:
【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'(%s,%s,%s)'at line……(以下省略)。
代码如下:
cursor.execute('insert into test values({0},{1},{2})',param)
python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号