!/usr/bin/python
-- coding:utf-8 --
import os
import sqlite3
create the connect
conn = sqlite3.connect(‘sample_database’)
recive the cursor 游标
cursor=conn.cursor();
cursor.execute(“”“create table employee( empid integer,firstname varchar, secondname varchar,mangid integer,deptid integer,phone varchar”“”)
cursor.execute(“”“insert into employee values(1,’Eric’,’Forster-Johnson’,1,1,’555-5555’)”“”)
cursor.execute(“”“insert into employee values(2,’Eric’,’Forster-Johnson’,1,1,’555-5555’)”“”)
conn.commit()
cursor.execute(“”“select * from employee”“”);
conn.commit()
for row in cursor.fetchall():
print row
cursor.close()
conn.close()