作者veryhungry12 (hungry1212)
看板Python
標題[問題]讀取csv檔案
時間Mon Feb 6 18:31:11 2017
http://imgur.com/a/AeXhL
我想讀取books1.csv檔案,然後插入book.db檔案.
可是卻顯示name 'curs' is not defined.
我也試過前面還用connect(),在用cursor()
可是也顯示keyerro:'title'的錯誤.
想請求幫忙.
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 117.19.177.75
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1486377073.A.1A9.html
→ kenduest: 你的開啟 sqlite db - book.db 的敘述程式碼沒寫? 02/06 18:50
→ kenduest: 先開啟 db 連線 con = sqlite3.connect('test.db') 02/06 18:55
→ kenduest: 後續用 curs = con.execute(.....) 來執行 sql 敘述 02/06 18:56
→ kenduest: 建議詳細看一下 python 官方文件有範例說明 02/06 18:56