kindle manager

This commit is contained in:
gavin
2020-06-16 09:50:09 +08:00
parent 956e68f551
commit 2171955111
15 changed files with 19 additions and 3 deletions

37
tfile/tsqllite.py Normal file
View File

@@ -0,0 +1,37 @@
#########################################################
## @file : tsqlite.py
## @desc : test sqlite3
## @create : 2020/06/11
## @author : Chengan
## @email : douboer@gmail.com
#########################################################
import sqlite3
dbname = 'vocab.db'
conn = sqlite3.connect(dbname)
try:
cursor = conn.cursor()
sql1 = '''select * from words;'''
sql2 = '''select * from lookups;'''
# fetch one record
cursor.execute(sql2)
one=cursor.fetchone()
print(one)
# fetch all records
for row in cursor.fetchall():
print(row)
# fetch table structure
except Exception as e:
print('sql failure {}'.format(e))
pass
finally:
conn.close()