Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中从SQlite3数据库创建HTML报告_Python_Html_Sqlite - Fatal编程技术网

在Python中从SQlite3数据库创建HTML报告

在Python中从SQlite3数据库创建HTML报告,python,html,sqlite,Python,Html,Sqlite,我目前正在使用下面的代码从Sqlite3数据库中选择某些信息,以便将信息返回给用户。我想知道是否有人能为我指出一个库/函数的正确方向,该库/函数允许我为用户创建一个易于阅读的HTML报告,而不是显示的标准终端 亲切的问候 connect = sqlite3.connect(sqlitedb) with connect: cur = connect.cursor() cur.execute("""SELECT messages._id,messages.body, particip

我目前正在使用下面的代码从Sqlite3数据库中选择某些信息,以便将信息返回给用户。我想知道是否有人能为我指出一个库/函数的正确方向,该库/函数允许我为用户创建一个易于阅读的HTML报告,而不是显示的标准终端

亲切的问候

connect = sqlite3.connect(sqlitedb)
with connect:
    cur = connect.cursor()
    cur.execute("""SELECT messages._id,messages.body, participants_info.number, participants_info.display_name, participants_info._id
        FROM messages
        INNER JOIN participants_info
        ON messages.participant_id = participants_info._id;""")
while True:

row = cur.fetchone()
if row == None:
    break
print (row)

我自己从未使用过它,但我知道
pandas
有一个DataFrame.to_html方法,所以您可以做的是:

作为pd进口熊猫
frame=pd.read\u sql\u查询(您的查询、sql\u连接)
frame.to_html()
您可以阅读详细信息