【问题标题】:modifying table size when sending email via python通过python发送电子邮件时修改表大小
【发布时间】:2022-06-14 22:53:41
【问题描述】:

我有一个 pandas 数据框,我通过电子邮件发送给自己。 我可以控制标题和正文的字体大小,但是数据框本身是它的默认大小,对我来说有点小。 如何增加正在发送的表的大小?

这是我正在使用的代码的 html 部分:

html = """\
<html>
  <head></head>
  <h1 style="color:red;font-size:25px;">This is My Header</h1>  
  <p style="width:50px;height:50px;">
  <body>
  {0}
  </body>
  </p>
</html>
""".format(df3.to_html())
consumptions = MIMEText(html, 'html')
msg.attach(consumptions)

有什么建议吗?

【问题讨论】:

  • 如果你有一个特定大小的数据框,你可以添加列或行,如果你需要使它更大。
  • 生成的HTML是否包含style设置字体大小?如果不是,它将继承其父元素的大小,因此只需在 &lt;body&gt; 上添加一个 style

标签: python html python-3.x email


猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-09-14
  • 2022-01-01
  • 2012-12-15
  • 2011-05-08
  • 2012-02-07
  • 2015-10-26
  • 2016-09-09
相关资源
最近更新 更多