python - Flask mysql 查询 = 查询% self._escape_args(args, conn) TypeError : not all arguments converted during string formatting

标签 python mysql flask

我几乎尝试了所有方法来使我的第一个 Flask 任务在 cloud9 上运行,但仍然给我这个错误

cursor.execute('''INSERT INTO studentmaster 
                       (Student_Id,Student_FirstName,Student_LastName,
                        Course_Id,Gender,Residential_Address,
                        PhoneNo,Email,Password) 
                  VALUES (%s,%s,%s,%s,%s,%s,%s)''',
               (stid,firstname, lastname, coursename, gender, address,
                phone, email,password))

这是我的应用程序的链接 https://ide.c9.io/hunteelar/studentregistration#openfile-README.md

最佳答案

表名中有 9 列,值中有 9 个变量,但值中只有 7 %s (%s......%s)

cursor.execute('INSERT INTO studentmaster 
  (Student_Id,Student_FirstName,Student_LastName,Course_Id,Gender,Residential_Address,PhoneNo,Email,Password) 
  VALUES (%s,%s,%s,%s,%s,%s,%s)',
  (stid,firstname, lastname, coursename, gender, address,phone, email,password))

关于python - Flask mysql 查询 = 查询% self._escape_args(args, conn) TypeError : not all arguments converted during string formatting,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43158988/

相关文章:

python - 使用 pandas.read_csv 读取以空格为千位分隔符的 CSV 文件

mysql选择具有B列和相关列C的最小值的不同列A

python - 使用 Flask-Admin 上传多张图片

mysql - 让 --lines-terminated-by 在 mysqldump 中工作

python - 如何将变量从本地 Flask 应用程序传递到远程 Flask 应用程序

http - 如何在 flask restplus swagger 中记录 HTTP POST/PUT 数据二进制上传?

python - Pandas 等效于 Oracle Lead/Lag 函数

Python PIL : image crop with black area if not enough photo region

python - 如何通过查找内部 div 的元素来单击外部 div

php - Mysql创建日期(记录更新时不更新)