Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在python中,如何制作模板。通过从用户处获取输入_Python_Templates - Fatal编程技术网

在python中,如何制作模板。通过从用户处获取输入

在python中,如何制作模板。通过从用户处获取输入,python,templates,Python,Templates,如何以邮件的形式制作模板。该模板从用户处获取输入以及python编程中邮件正文中明确提到的输入。一个简单的尝试,以防您想要生成纯文本邮件(尽管我想您也可以对html正文使用此方法) Python有时非常简单 name= input(prompt='Please enter the name of the receipient: ') url= input(prompt='please enter the URL: ') my_name= input(prompt='please enter yo

如何以邮件的形式制作模板。该模板从用户处获取输入以及python编程中邮件正文中明确提到的输入。

一个简单的尝试,以防您想要生成纯文本邮件(尽管我想您也可以对html正文使用此方法)

Python有时非常简单

name= input(prompt='Please enter the name of the receipient: ')
url= input(prompt='please enter the URL: ')
my_name= input(prompt='please enter your name: ')
mail_body= f"""
Dear {name},

we are proud to inform you, that we have just released a new version
of our anti-spam software, that reliably filters out unwanted mails
from your post box.

For more information please visit
{url}

Kind regards
{my_name}
"""
print(mail_body)

嗨,马赫什,欢迎来到SO。请在您的帖子中添加所需的输出。现在还不清楚您是否想要创建纯文本邮件,以及您所说的模板是什么意思。也不太清楚,您所说的“哪些输入来自用户”是什么意思。你是说输入语句,还是说应该从用户提供的文件(如csv)中读取。