1. python 储存sqlite
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine('sqlite:///test.db')
data = {'name':['Bob','Bob1']}
df = pd.DataFrame(data)
df.to_sql('tb_test',engine)
2.python 读取sqlite
import pandas as pd
from sqlalchemy import create_engine
engine= create_engine('sqlite:///test.db')
frame = pd.read_sql('tb_test', engine)
print(frame)
3.cmd 访问 sqlite
C:\Users\Administrator\PycharmProjects\pythonProject3>sqlite3 test.db
SQLite version 3.32.3 2020-06-18 14:00:33
Enter ".help" for usage hints.
sqlite> .tables
tb_test
sqlite> select * from tb_test;
0|Bob
1|Bob1
sqlite>