PySqlite 开发中的应用

来源:互联网 发布:zip解压密码破解软件 编辑:程序博客网 时间:2024/05/05 14:36

-、首先简介pysqlite.

from pysqlite2 import dbapi2 as sqlite3


persons = [
    (12,314),
    ("Calvin", "Klein")
    ]

con = sqlite3.connect("C:\\aa.db")

# Create the table
#con.execute("create table person(firstname, lastname)")


# Fill the table
con.executemany("insert into person(firstname, lastname) values (?, ?)", persons)

for row in con.execute("select firstname, lastname from person"):
    print row


con.close()


二、用处。

在程序运行中,不可能所有的数据都存内存啊,但是又没有其他好地方这就是好地方。存储临时数据。

0 0
原创粉丝点击