# -*- coding: UTF-8 –*-
import sqlite3
conn=sqlite3.connect('e:\test.db')
with conn:
curs=conn.cursor()
curs.execute("XXX")#XXX为SQL查询语句
datas=curs.fetchall()
fout=file('dbout.txt','w')
for data in datas:
print data[0],data[1],data[2],data[3]
fout.write("%s\t%s\t%s\t%s\n" % (str(data[0]),str(data[1]),str(data[2]),str(data[3])))
fout.close()