作者: shaoliang 2020-04-11 09:46   访问数:784
import sqlite3 conn = sqlite3.connect("/home/sl/2.db") c = conn.cursor() # c.execute("drop table login") # c.execute('create table login (id integer primary key, name varchar(30), password varchar(30))') # conn.commit() # name1=input("输入名字:") # # name1="ttt" # sql = "insert into login('name') values ('"+name1+"')" # c.execute(sql) # conn.commit() sql="delete from login where id=1" c.execute(sql) conn.commit() c.execute("select * from login order by id desc") for r in c.fetchall(): a = r[0] b = r[1] print(a) c.close() conn.close()