import sqlite3
conn = sqlite3.connect('db_file_name.db') #
cursor = conn.cursor() # 获取游标
cursor.execute('insert into table_name set name=?',('name_value',))
cursor.execute('update table_name set name=? where id=?',('name_value',1))
cursor.execute('delete from table_name where id=?',(1,))
cursor.rowcount # insert,update,delete影响的数据条数
cursor.execute('select * from table_name where name=?',('name_value',))
data = cursor.fetchall() # 获取数据
cursor.close() # 关闭游标
conn.commit() # 提交数据库查询
conn.close() # 关闭数据库连接