【发布时间】:2020-08-26 18:43:56
【问题描述】:
我已经导出了一些Pandas DataFrame 集合,并为表格添加了某种形式的样式。现在有 76 个 dataframes 我已导出为 HTML 文件。
现在我想将它们合并到一个 HTML 文件中,如果可能的话,从这些标题中生成一个可点击的目录。
我的问题有点类似于:Python/html- Combine multiple html's into one
我试图跟随它,但它完全不同。
到目前为止,这是我所做的:
import glob
df= glob.glob("*.html")
names = [i.split(".")[0] for i in df]
html = "</head> <body> <p>Data as of 5/11/2020</p> <br><p>ABC comps</p> </body></html>"
for i in df:
html += '<h3>%s</h3>' % (names)
html += '<a href="%s">Your Report Title</a>' % (df)
with open("test1.html", "w") as f:
f.write(html)
但这不起作用。非常感谢您对此提供的帮助
【问题讨论】:
标签: python html python-3.x pandas styles