很悲催的是我寫錯了,之前的插入沒有問題。但是更新就報錯了,本身就是我的寫法有錯誤,有必要記錄一下。
插入語句是沒有問題的,這是因為所有項都是字符串。
con.execute("insert into b(isbn, bn, bk, bs, author, publisher, publishdate) values (%s,%s,%s,%s, %s, %s, %s)",([isbn, bn, bk, bs, author, publisher, publishdate]))
一旦有數字就完了,就會報上面的錯誤。
更改如下:
con.execute("update b set maxstore=(%d) where bk='醫葯'"%(a))
OK~