手机
当前位置:查字典教程网 >脚本专栏 >python >python从sqlite读取并显示数据的方法
python从sqlite读取并显示数据的方法
摘要:本文实例讲述了python从sqlite读取并显示数据的方法。分享给大家供大家参考。具体实现方法如下:importcgi,os,sysimp...

本文实例讲述了python从sqlite读取并显示数据的方法。分享给大家供大家参考。具体实现方法如下:

import cgi, os, sys import sqlite3 as db conn = db.connect('test.db') cursor = conn.cursor() conn.row_factory = db.Row cursor.execute("select * from person") rows = cursor.fetchall() sys.stdout.write("Content-type: text.htmlrnrn") sys.stdout.write("") sys.stdout.write("<html><body><p>") for row in rows: sys.stdout.write("%s %s %s" % (row[0],row[1],row[2])) sys.stdout.write("<br />") sys.stdout.write("</p></body></html>")

希望本文所述对大家的Python程序设计有所帮助。

【python从sqlite读取并显示数据的方法】相关文章:

简单文件操作python 修改文件指定行的方法

python脚本实现查找webshell的方法

python paramiko实现ssh远程访问的方法

python 字符串split的用法分享

Python实现全局变量的两个解决方法

python 实现归并排序算法

使用python 获取进程pid号的方法

python逐行读取文件内容的三种方法

盘点提高 Python 代码效率的方法

python读取注册表中值的方法

精品推荐
分类导航