看板 Python 關於我們 聯絡資訊
http://i.imgur.com/2yGxAf8.jpg 我要把資料丟進mysql 可是有錯誤 http://i.imgur.com/7RR7jLM.jpg 想請問要怎麼解決這個問題? 資料庫裡屬性數量是4 程式碼也是4 下面這個是b裡面的格式 http://i.imgur.com/I2hv9IQ.jpg ----- Sent from JPTT on my OPPO CPH1701. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.138.51.78 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1575220933.A.B89.html ※ 編輯: lucy35 (223.138.51.78 臺灣), 12/02/2019 01:23:28
hongyan: str = ("%s %s %s %s")%(a, b, c, d) 12/02 02:00
hongyan: 不然就是 (".... vaules({},{},{},{})").format(a,b,c,d) 12/02 02:01
hongyan: 更正1F(".... values (%s, %s, %s ,%s)")%(a, b , c ,d) 12/02 02:04
ilms49898723: 我猜 cursor.execute(insert, b) 就好 12/02 11:55
會顯示 not all argument converted during string formatting 錯誤 ※ 編輯: lucy35 (223.138.51.78 臺灣), 12/02/2019 20:41:13
justoncetime: 找pastbin之類貼完整程式碼 12/02 22:10
marc47: for row in b: 12/04 03:19
marc47: cursor.execute(insert,row) 12/04 03:19
解決了!!謝謝 ※ 編輯: lucy35 (42.76.105.109 臺灣), 12/09/2019 01:04:53