导入sqlite模块
import sqlite3 as sqlite
连接数据库
conn=sqlite.connect('d:/sqlite3/demo.sqlite3')
创建游标
cur=conn.cursor()
创建表
table="create table books (id,title,author,language)"
cur.execute(table)
增加数据
cur.execute('insert into books values (2,"pandas数据分析","明日科技","python")')
提交
conn.commit()
查询数据
cur.execute('select * from books')
print(cur.fetchall())
关闭连接
conn.close()