Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/326.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 如何在Flask中的页面上显示html文件_Python_Pandas_Flask - Fatal编程技术网

Python 如何在Flask中的页面上显示html文件

Python 如何在Flask中的页面上显示html文件,python,pandas,flask,Python,Pandas,Flask,我试图将我的报告呈现到页面上,但是html代码显示的不是实际的对象,我如何显示该对象 profile = pp.ProfileReport(df, check_correlation=False) return render_template('profile.html', my_bucket=my_bucket, profile=profile.to_html()) 将{{profile | safe}}}添加到我的代码中修复了这个问题,因为它现在在模板中呈现概要文件,感谢@abdou编辑

我试图将我的报告呈现到页面上,但是html代码显示的不是实际的对象,我如何显示该对象

profile = pp.ProfileReport(df, check_correlation=False)

return render_template('profile.html', my_bucket=my_bucket, profile=profile.to_html())

{{profile | safe}}}
添加到我的代码中修复了这个问题,因为它现在在模板中呈现概要文件,感谢@abdou

编辑
profile.html
模板,以确保它显示
{profile | safe}
。这将在模板内呈现配置文件。Flask将在计算机上的
模板
文件夹中查找HTML文件。因此,当您调用render_template时,它会在那里检查您的文件。您可能希望尝试
profile.to_file()
并编写一个文件,如果无法使其正常工作,则可以在
render_tempalate
中引用该文件作为解决方法。