python学习笔记:sqlite3查询

import sqlite3

if __name__ =='__main__':
    db_file='d:\\data.db'
    conn=sqlite3.connect(db_file)
    cur=conn.cursor()
    cur.execute('SELECT * FROM table1')
    records=cur.fetchall()
    for x in records:
        print x[0]+' '+x[1] #有多少列就打印多少个
    conn.close()

原文地址:https://www.cnblogs.com/nethirte/p/3091086.html