【发布时间】:2021-04-03 07:01:31
【问题描述】:
我编写了一个将数据框转换为 html 并通过电子邮件发送的代码。我需要将此表与另一个表联合/附加(一个在另一个之上)。有人可以帮我弄清楚我会怎么做吗?
这是我的代码:
# 'dataset' holds the input data for this script import pandas
from email.mime.text import MIMEText from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from smtplib import SMTP import smtplib import sys
msg = MIMEMultipart() msg['Subject'] = "Daily Report" msg['From'] = 'MM@gmail.com'
html = """\ <html> <head></head> <body>
{0} </body> </html> "Name" """.format(pandas.DataFrame(dataset).to_html())
part1 = MIMEText(html, 'html') msg.attach(part1)
server = smtplib.SMTP_SSL("smtp.gmail.com",465) server.login('MM@gmail.com', 'pythontest') server.sendmail("Sender@gmail.com","Receiver@python.com",msg.as_string()) server.quit()*
【问题讨论】:
-
这能回答你的问题吗? How do I combine two dataframes?
标签: python email concatenation mime