美文网首页
python从sqlite读取数据并显示的代码

python从sqlite读取数据并显示的代码

作者: we1212 | 来源:发表于2021-10-20 14:58 被阅读0次

下面的内容段是关于python从sqlite读取数据并显示的内容。

import cgi, os, sys

import sqlite3 as db

conn = db.connect('test.db')

cursor = conn.cursor()

conn.row_factory = db.Row

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从sqlite读取数据并显示的代码

      本文链接:https://www.haomeiwen.com/subject/saptaltx.html