立即学习:https://edu.csdn.net/course/play/24797/282205?utm_source=blogtoedu
import sqlite3 conn = sqlite3.connect('test52.db') c = conn.cursor() # 执行查询语句 c.execute('select * from user_tb') # description属性(元组)返回类信息 for col in c.description: print(col[0], end='\t') print() # fetchall() 返回所有数据,大数据量不介意使用 # for val in c.fetchall(): # print(val) # fetchone() 返回一行数据 # while True: # row = c.fetchone() # if row: # for val in row: # print(val, end='\t') # print() # else: # break # fetchmany(n) n小于列表数量 # for val in c.fetchmany(2): # print(val) for val in c: print(val) c.close() conn.close()