<p>我正在寻找一个python解决方案来创建一个static.html,它可以通过电子邮件发送出去,可以附加在电子邮件中,也可以嵌入在电子邮件中(如果需要更多的工作,请忽略后一个选项)。我对.html的布局没有要求。这里的重点是确定生成offline.html的不那么痛苦的解决方案。在</p>
<p>一个潜在的解决方案可以是下面的伪代码。在</p>
<pre><code>from some_unknown_pkg import StaticHTML
# Initialise instance
newsletter = StaticHTML()
# <a href="https://www.cnpython.com/list/append" class="inner-link">append</a> charts, tables and text to blank newsletter.
newsletter.append(text_here)
newsletter.append(interactive_chart_generated_with_plotly)
newsletter.append(more_text_here)
newsletter.append(a_png_file_loaded_from_local_pc)
# Save newsletter to .html, ready to be sent out.
newsletter.save_to_html('newsletter.html')
</code></pre>
<p>其中<code>'newsletter.html'</code>可以在任何浏览器中打开。为了提供更多的上下文,this.html应该发送给我公司内部的一些选定人员,并包含一些合理的数据。我正在使用plotly来生成要插入到.html中的交互式图表。在</p>