Python connects to sqlite and operations, and python connects to sqlite
Import sqlite3 # query def load (table): # connect to the database con = sqlite3.connect ("E:/Datebase/SQLiteStudio/Park. db ") # obtain the cursor cur = con. cursor () # query the entire table cur.exe cute ('select * from' + table) lists = ['name', 'Password'] if table = 'login ': # store the database column name in the dictionary colnames = {desc [0] for desc in cur. description} saves the dictionary and database data to the list and obtains the record dictionary rowdicts = [dict (zip (lists, row) for row in cur. fetchall ()] else: rowdicts = [] for row in cur: row Dicts. append (row) con. commit () cur. close () return rowdicts # insert data def insert_data (ID, name, money): con = sqlite3.connect ("E:/Datebase/SQLiteStudio/Park. db ") cur = con. cursor () # use an SQL statement to insert cur.exe cute ('insert into Charge values (?,?,?) ', (ID, name, money) # query the entire table after insertion to see if cur.exe cute ('select * from charge') print (cur. fetchall () con. commit () cur. close ()