4、函数参数
形参、实参、
def get_list_first_data(aaa): # aaa叫形式参数(形参)
v = [11,22,33,44]
print(v[aaa])
get_list_first_data(1) # 2/2/1调用函数时传递叫:实际参数(实参)
get_list_first_data(2)
get_list_first_data(3)
get_list_first_data(0)
# 假如:管理员/业务员/老板用的是同一个邮箱。
"""
def send_email(to):
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
msg = MIMEText('导演,我想演男一号,你想怎么着都行。', 'plain', 'utf-8')
msg['From'] = formataddr(["李邵奇", '[email protected]'])
msg['To'] = formataddr(["导演", to])
msg['Subject'] = "情爱的导演"
server = smtplib.SMTP("smtp.163.com", 25)
server.login("[email protected]", "qq1105400511")
server.sendmail('[email protected]', [to, ], msg.as_string())
server.quit()
"""
def send_email(to):
template = "要给{0}发送邮件".format(to,))
print(template)
user_input = input('请输入角色:')
if user_input == '管理员':
send_email('[email protected]')
elif user_input == '业务员':
send_email('[email protected]')
elif user_input == '老板':
send_email('[email protected]')