创建表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简单操作
张小明
前端开发工程师
打造个性化语音助手|基于科哥开发的Voice Sculptor镜像实现指令化合成
打造个性化语音助手|基于科哥开发的Voice Sculptor镜像实现指令化合成 1. 引言:从“通用语音”到“个性表达”的演进 在智能语音技术快速发展的今天,用户对语音合成(TTS)的需求早已超越了“能说话”的基础阶段&#…
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 Live Editor终极指南:5步实现可视化图表零基础入门
Mermaid Live Editor终极指南:5步实现可视化图表零基础入门 【免费下载链接】mermaid-live-editor Edit, preview and share mermaid charts/diagrams. New implementation of the live editor. 项目地址: https://gitcode.com/GitHub_Trending/me/mermaid-live-e…
Qwen微调实战:从入门到精通的完整指南
Qwen微调实战:从入门到精通的完整指南 【免费下载链接】Qwen The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud. 项目地址: https://gitcode.com/GitHub_Trending/qw/Qwen 在当今大语言模型快速…
15分钟搞定Paperless-ngx开发环境:VS Code+Docker全栈调试实战
15分钟搞定Paperless-ngx开发环境:VS CodeDocker全栈调试实战 【免费下载链接】paperless-ngx A community-supported supercharged version of paperless: scan, index and archive all your physical documents 项目地址: https://gitcode.com/GitHub_Trending/…
AI量化投资决策引擎:千股并行预测实战全解析
AI量化投资决策引擎:千股并行预测实战全解析 【免费下载链接】Kronos Kronos: A Foundation Model for the Language of Financial Markets 项目地址: https://gitcode.com/GitHub_Trending/kronos14/Kronos 三分钟部署智能投研系统,批量选股策略…