Python操作splite3的例子

来源:互联网 发布:大数据的未来前景 编辑:程序博客网 时间:2024/04/19 13:18
__author__ = 'Administrator'
import sqlite3
def inser(*args,**kwargs):
    '''
    增加数据输入
    '''
    #print(args)
    cour.execute("insert into mytest(name,telephone,phone,email,qq)values(?,?,?,?,?)",args,)
def insertManyInfo(*args,**kwargs):
    pass

def getInfo():
    cour.execute("select * from mytest")
    for k,n,te,ph,em,q in cour:
        print(k," ",n," ",te," ",ph," ",em," ",q)
def getAllInfo():
    cour.execute("select * from mytest")
    for item in cour.fetchall():
        print(item)
con=sqlite3.connect(r"F:\\baidu download\\test.db")
cour=con.cursor()
try:

    cour.execute("drop table mytest")
except:
    print()
cour.execute("create table mytest(id INTEGER primary key autoincrement not null,"
             "name text not null,"
             "telephone int not null,"
             "phone int not null,"
             "email text not null,"
             "qq int not null)")

if __name__=="__main__":
    inser("Liming","13532100265","010-4565892","619617021@qq.com","619617021")

    getInfo()#显示信息#显示单个信息
    getAllInfo()#返回的是Tuple
0 0
原创粉丝点击