Python_查看sqlite3表结构,查询语句的示例代码
作者:Martin_Yelvin 时间:2021-01-24 22:35:06
如下所示:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sqlite3
conn = sqlite3.connect('test.db')
# 创建一个Cursor:
cursor = conn.cursor()
# 查询记录:
conn = sqlite3.connect('calendar.db')
cursor = conn.cursor()
# 执行查询语句:
cursor.execute('select * from perpetualCalendar')
# 获得查询结果集:
values = cursor.fetchall()
print(values)
# cursor.execute('PRAGMA table_info(perpetualCalendar)')
print (cursor.fetchall())
cursor.close()
conn.close()
查看表结构:cursor.execute('PRAGMA table_info(表名)')
来源:https://blog.csdn.net/qq_36279445/article/details/81116574
标签:Python,sqlite3,表结构,查询
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python字符串的15个基本操作(小结)
2023-08-11 00:11:13
python自定义时钟类、定时任务类
2021-02-12 12:21:37
Tensorflow的常用矩阵生成方式
2023-03-27 16:03:55
找不到类型或命名空间名称“Server”(是否缺少 using 指令或程序集引用?)
2023-07-07 21:50:15
Python numpy.interp的实例详解
2023-01-21 07:07:06
![](https://img.aspxhome.com/file/2023/0/89330_0s.png)
python脚本框架webpy入门安装及应用创建
2023-08-23 05:08:51
asp base64加解密函数代码
2011-03-31 11:02:00
详解Pytorch如何利用yaml定义卷积网络
2023-02-16 10:46:01
妙用Dreamweaver MX共享Word XP文件
2010-09-05 21:17:00
![](https://img.aspxhome.com/file/UploadPic/20072/200723113242108s.jpg)
python绘制规则网络图形实例
2021-08-31 02:28:28
Python实现遗传算法(二进制编码)求函数最优值方式
2023-05-07 15:51:40
![](https://img.aspxhome.com/file/2023/4/90954_0s.jpg)
使用python向MongoDB插入时间字段的操作
2021-05-21 06:54:19
如何将函数的实际参数转换成数组
2010-01-11 19:59:00
python实现某考试系统生成word试卷
2022-05-20 18:29:09
![](https://img.aspxhome.com/file/2023/1/101561_0s.jpg)
Python完全新手教程
2021-08-19 18:38:06
PyTorch中关于tensor.repeat()的使用
2023-06-26 07:13:35
页面加载对访问的影响
2009-10-30 18:54:00
![](https://img.aspxhome.com/file/UploadPic/200910/30/speed_taobaoued-30s.png)
详解django中url路由配置及渲染方式
2021-04-29 01:28:50
![](https://img.aspxhome.com/file/2023/5/77035_0s.png)
教你如何使用php session
2023-11-15 06:28:01
Flash在web客户端的潜在问题
2009-05-20 12:11:00