python邮件模块发送的table如何添加垂直滚动条?

How to add vertical scrollbar to the table sent by python email module?

我有一个很长的数据帧,由 python 电子邮件模块发送。我希望它有一个垂直滚动条,以便整个电子邮件看起来紧凑。但是我不熟悉 HTML,不知道把 div style="overflow-y: auto;" part

放在哪里

以下是 html 代码。

email_html = """\
<html>
  <head>
      Dear all, <br>
  </head>
  <body>
    <p>
       1.Cash Flow <br>
    </p>  
       <div style="overflow-y: auto;">
       {0}
       </div>       
    <p>   
       Regards,
    </p>
  </body>
</html>
""".format(table_in_html_format)

它只是在像这样的电子邮件中生成简单的纯文本 table,没有附加滚动条。

提前谢谢!

也许你应该为那个设置一个明显的高度值 div

email_html = """\
<html>
  <head>
      Dear all, <br>
  </head>
  <body>
    <p>
       1.Cash Flow <br>
    </p>  
       <div style="overflow-y: auto;height:100px">
       {0}
       </div>       
    <p>   
       Regards,
    </p>
  </body>
</html>
""".format(table_in_html_format)