You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
549 B

import pickle
import sqlite3
def create_admin():
"""创建管理员默认为admin:admin"""
with open("administrators.pickle", "wb") as fp:
pickle.dump(("admin", "admin"), fp)
def create_db():
"""创建数据库文件,添加表"""
con = sqlite3.connect("./car_info.db")
cur = con.cursor()
cur.execute('create table car(id varchar primary key, name varchar, color varchar, addr varchar, phone int, stay_hours TEXT)')
con.commit()
cur.close()
con.close()
# create_admin()
create_db()