import sqlite3 |
try : |
sqlite_Connection = sqlite3.connect( 'temp.db' ) |
conn = sqlite_Connection.cursor() |
print ( "连接到 SQLite." ) |
sqlite_select_Query = "select sqlite_version();" |
conn.execute(sqlite_select_Query) |
record = conn.fetchall() |
print ( "SQLite 数据库的版本是 " , record) |
conn.close() |
except sqlite3.Error as error: |
print ( "连接到SQLite出错:" , error) |
finally : |
if (sqlite_Connection): |
sqlite_Connection.close() |
print ( "关闭SQLite连接" ) |