我已經在Windows 8上運行的x64下面的代碼:的SQLite 3數據庫沒有更新
import sqlite3 as db
conn = db.connect('test.db')
cursor = conn.cursor()
cursor.execute("create table films(title text, year text, director text)")
print("table created")
cursor.execute('insert into films values("Annie Hall","1977","Woody Allen")')
cursor.execute('insert into films values("The Godfather","1972","Francis Ford Coppola")')
conn.close()
檢查所創建的SQLite的文件(test.db的)(使用sqlite command-line shell,以測試是否有條目通過代碼創建的表)不顯示任何內容。任何幫助?
根據定義DB-API的[PEP](http://www.python.org/dev/peps/pep-0249/),只有當他以事務模式運行並且對數據庫事務的支持是可選的時, – hd1
如果我沒有記錯'isolation_level'默認不是* autocommit *模式。無論如何,我只是按照手動示例:http://docs.python.org/3/library/sqlite3.html :) –