[問題] sql問題?

看板Python作者 (pucca978)時間5年前 (2020/02/24 15:32), 編輯推噓1(103)
留言4則, 3人參與, 5年前最新討論串1/1
想請問前輩們 是我sql沒導入 還是哪邊有問題啊? import sqlite3 conn=sqlite3.connect('test.sqlite') cursor=conn.cursor() abc='CREATE TABLE IF NOT EXITS table01 \ <=若把\拿掉變成錯誤2 ("num" INTEGER PRIMARY KEY NOT NULL,"tel" TEXT)' ace='insert into table01 values(1,"03-1234567")' cursor.execute(abc) cursor.execute(ace) conn.commit() conn.close() OperationalError: near "EXITS": syntax error -錯誤1 SyntaxError: EOL while scanning string literal -錯誤2 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.62.247.25 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1582529524.A.7EC.html

02/24 15:54, 5年前 , 1F
EXISTS ?
02/24 15:54, 1F

02/24 16:26, 5年前 , 2F
先用sqlite命令列,或是管理工具如dbeaver確認SQL指
02/24 16:26, 2F

02/24 16:26, 5年前 , 3F
令正確性,可以逐步限縮範圍。除錯過程也會有收穫
02/24 16:26, 3F

02/24 19:31, 5年前 , 4F
就拼錯字
02/24 19:31, 4F
文章代碼(AID): #1UKtlqVi (Python)
文章代碼(AID): #1UKtlqVi (Python)