python 操作 sqlite

#encoding=utf-8
import sqlite3
from time import clock as now

start = now( )
##############################################################
conn = sqlite3.connect("e:\\TestDB.sqlite")
####################### 连接sqlite数据库 ##########################
c = conn.cursor()

c.execute('''create table test(name VARCHAR)''')

sql = ("insert into test(name) values (\'line1\')")
c.execute(sql)
sql = ("insert into test(name) values (\'line2\')")
c.execute(sql)
sql = ("insert into test(name) values (\'line3\')")
c.execute(sql)

conn.commit()
c.execute('select * from test group by name')
printRow = c.fetchall();

for row_data in printRow:
print(row_data)
c.close()

###############################################################
conn.close()
######################## 关闭连接 ###############################
###############################################################

finish = now( )
print ('脚本执行耗时:',finish – start,'单位')