Python应用编程需要用到的针对不同数据库引擎的数据库接口:http://wiki.python.org/moin/DatabaseInterfaces
Python标准的DB API 2.0见:http://MITstatement first, then executes the SQL script it gets as a parameter.
sql_scriptcan be an instance ofstrorbytes.
Example:
import sqlite3con = sqlite3.connect(":memory:")cur = con.cursor()cur.executescript(""" create table person( firstname, lastname, age ); create table book( title, author, published ); insert into book(title, author, published) values ( 'Dirk Gently''s Holistic Detective Agency', 'Douglas Adams', ); """)好了这篇文章就为大家介绍到这了,希望大家以后多多支持。