Python sqlite3

代码 · 2021-11-14 · 232 人浏览
# 查询示例 
# 引入支持
import sqlite3
# 打开数据库
conn = sqlite3.connect('data.db')
c = conn.cursor()
sql = "SELECT * FROM 数据表 WHERE name = '名字';"
cursor = c.execute(sql)
for row in cursor:
    print(row)       
conn.commit()
conn.close()
Python Sqlite3
Theme Jasmine by Kent Liao