Python概述(16)
Python操作SQLite
SQLite
动态类型
- NULL
- INTEGER
- REAL
- TEXT
- BLOB
SQLite操作
sqlite3
连接对象:sqlite3.connect(‘数据文件.db’)
游标:cursor = conn.cursor()
- exexcute(‘SQL语句’,[参数])
>>> import sqlite3
>>> conn = sqlite3.connect('xxx.db')
>>> c = conn.cursor()
>>> sql = "select * from LinkMan"
>>> result = c.execute(sql)
>>> conn.commit()
# 提取前两行
>>> c.fetchmany(2)
# 提取第一行
>>> c.fetchone()
来源:CSDN
作者:晨曦skyyyy
链接:https://blog.csdn.net/mingxisky/article/details/103706090