创建表importsqlite3# 连接文件数据库(不存在则自动创建)conn=sqlite3.connect("my_database.db")cursor=conn.cursor()# 创建表cursor.execute(""" create table if not exists users ( id integer primary key autoincrement, username text not null, age integer ) """)# 插入数据cursor.execute("insert into users(username, age) values("bob", 25)")conn.commit()# 查询数据cursor.execute("select * from users")print(cursor.fetchall())# 输出: [(1, 'bob', 25)]conn.close()-----------------------------------------------------------------------------------删除表中数据importsqlite3 DB_FILE="C:/inoutsave.db"# 连接到SQLite数据库conn=sqlite3.connect(DB_FILE)try:# 创建一个游标对象cursor=conn.cursor()# 执行DELETE语句清除表数据cursor.execute("DELETE FROM io_record")# 提交事务conn.commit()exceptsqlite3.Errorase:print(f"An error occurred:{e}")# 如果发生错误,则回滚事务conn.rollback()finally:# 关闭数据库连接conn.close()sqlite3简单操作
张小明
前端开发工程师
Mermaid Live Editor 终极使用指南:零基础绘制专业图表
Mermaid Live Editor 终极使用指南:零基础绘制专业图表 【免费下载链接】mermaid-live-editor Edit, preview and share mermaid charts/diagrams. New implementation of the live editor. 项目地址: https://gitcode.com/GitHub_Trending/me/mermaid-live-edito…
Ultimate Vocal Remover 5.6:零基础掌握AI音频分离的完整解决方案
Ultimate Vocal Remover 5.6:零基础掌握AI音频分离的完整解决方案 【免费下载链接】ultimatevocalremovergui 使用深度神经网络的声音消除器的图形用户界面。 项目地址: https://gitcode.com/GitHub_Trending/ul/ultimatevocalremovergui 还在为提取纯净人声…
终极指南:5分钟彻底解决PDF字体缺失修复难题
终极指南:5分钟彻底解决PDF字体缺失修复难题 【免费下载链接】PDFPatcher PDF补丁丁——PDF工具箱,可以编辑书签、剪裁旋转页面、解除限制、提取或合并文档,探查文档结构,提取图片、转成图片等等 项目地址: https://gitcode.com…
Mermaid Live Editor在线图表编辑器完整使用教程
Mermaid Live Editor在线图表编辑器完整使用教程 【免费下载链接】mermaid-live-editor Edit, preview and share mermaid charts/diagrams. New implementation of the live editor. 项目地址: https://gitcode.com/GitHub_Trending/me/mermaid-live-editor Mermaid Li…
OpenArk实战指南:Windows系统安全深度检测与反rootkit完整解决方案
OpenArk实战指南:Windows系统安全深度检测与反rootkit完整解决方案 【免费下载链接】OpenArk The Next Generation of Anti-Rookit(ARK) tool for Windows. 项目地址: https://gitcode.com/GitHub_Trending/op/OpenArk 你是否曾经担心自己的Windows系统被恶意…
TradingAgents-CN终极指南:3小时快速上手智能交易系统
TradingAgents-CN终极指南:3小时快速上手智能交易系统 【免费下载链接】TradingAgents-CN 基于多智能体LLM的中文金融交易框架 - TradingAgents中文增强版 项目地址: https://gitcode.com/GitHub_Trending/tr/TradingAgents-CN 还在为复杂的金融数据分析而头…