python从sqlite读取并显示数据的方法
2015-05-08 12:16
776 查看
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.html\r\n\r\n") 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实现读取TXT文件数据并存进内置数据库SQLite3的方法
- python 读取并显示图片的两种方法
- python 读取并显示图片的两种方法
- Python读取和处理文件后缀为".sqlite"的数据文件
- Python读取和处理文件后缀为.sqlite的数据文件(实例讲解)
- python 读取并显示图片的两种方法
- Python实现将SQLite中的数据直接输出为CVS的方法示例
- Python读取并显示图片的两种方法
- Python实现读写sqlite3数据库并将统计数据写入Excel的方法示例
- 用Excel演示python中pandas中数据的查询显示方法-python数据分析入门
- Python-Pandas(1)数据读取与显示,数据样本行列选取
- Python读取SQLite文件数据
- Python3 configparser读取含有中文配置config.ini(Windows)显示乱码的解决方法
- Yahoo! Finance财经数据PYTHON临时读取方法
- python 读取并显示图片的两种方法
- Python3读取Excel数据存入MySQL的方法
- Python实现读取SQLServer数据并插入到MongoDB数据库的方法示例
- python中plot实现即时数据动态显示方法
- Python读取txt文件数据的方法(用于接口自动化参数化数据)