[Python] python从sqlite读取数据并显示 →→→→→进入此内容的聊天室

来自 , 2021-01-02, 写在 Python, 查看 110 次.
URL http://www.code666.cn/view/479b4864
  1. import cgi, os, sys
  2. import sqlite3 as db
  3.  
  4. conn = db.connect('test.db')
  5. cursor = conn.cursor()
  6. conn.row_factory = db.Row
  7. cursor.execute("select * from person")
  8. rows = cursor.fetchall()
  9.  
  10. sys.stdout.write("Content-type: text.html\r\n\r\n")
  11. sys.stdout.write("")
  12. sys.stdout.write("<html><body><p>")
  13. for row in rows:
  14.    sys.stdout.write("%s %s %s" % (row[0],row[1],row[2]))
  15.    sys.stdout.write("<br />")
  16. sys.stdout.write("</p></body></html>")
  17. #//python/7380

回复 "python从sqlite读取数据并显示"

这儿你可以回复上面这条便签

captcha