将当前季度添加到电子邮件主题 - Python
Adding current quarter to email subject - Python
我正在尝试编写一个脚本,将当前季度添加到电子邮件的主题中,但我不确定是否可行,我们将不胜感激。
请看下面的代码:
import win32com.client as client
import datetime
# Get Quarter
Today=datetime.datetime.now()
# Using Pandas Timestamp to get quarter
TodayTimeStamp=pd.Timestamp(Today)
quarter = TodayTimeStamp.quarter
quarter
# Send the email
outlook = client.Dispatch('Outlook.Application')
# Mail item
message = outlook.CreateItem(0)
message.Display()
message.To = "Louise.Sweeney.Contractor@pepsico.com"
message.Subject = "File Q"+quarter
message.HTMLBody = "Hello World"
message.Send()
我不确定您是否遇到任何错误,但是将此添加到您的主题应该没有问题,您只需确保将四分之一转换为字符串类型。你可以像下面那样做
message.Subject = f'File Q{quarter}'
我正在尝试编写一个脚本,将当前季度添加到电子邮件的主题中,但我不确定是否可行,我们将不胜感激。
请看下面的代码:
import win32com.client as client
import datetime
# Get Quarter
Today=datetime.datetime.now()
# Using Pandas Timestamp to get quarter
TodayTimeStamp=pd.Timestamp(Today)
quarter = TodayTimeStamp.quarter
quarter
# Send the email
outlook = client.Dispatch('Outlook.Application')
# Mail item
message = outlook.CreateItem(0)
message.Display()
message.To = "Louise.Sweeney.Contractor@pepsico.com"
message.Subject = "File Q"+quarter
message.HTMLBody = "Hello World"
message.Send()
我不确定您是否遇到任何错误,但是将此添加到您的主题应该没有问题,您只需确保将四分之一转换为字符串类型。你可以像下面那样做
message.Subject = f'File Q{quarter}'