首页 > 解决方案 > Ironpython Spotfire / 导出到 html 文件

问题描述

我已经看到了通过 ironpython 导出到 excel 或 pdf 的方法,但我真正需要的是使用 ironpython 脚本创建一个 html 文件。

现在我正在使用这行代码,但我能够创建文档。

with open("C:\\Users\\output\\testfile.html","w") as file:
    file.write(htmlReport)

标签: pythonironpythonspotfirespotfire-analyst

解决方案


我尝试了这段代码,它似乎可以工作并创建 html 文件-

htmlReport="""<html>
<body><table border=1>
<tr><td>1</td><td>AAA</td></tr><tr><td>2</td><td>BBB</td></tr><tr><td>3</td><td>CCC</td></tr></table></body></html>"""


with open("C:\\temp\\testfile.html","w") as file:
    file.write(htmlReport)

推荐阅读