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(["李邵奇", '15776556369@163.com'])
msg['To'] = formataddr(["导演", to])
msg['Subject'] = "情爱的导演"
server = smtplib.SMTP("smtp.163.com", 25)
server.login("15776556369@163.com", "qq1105400511")
server.sendmail('15776556369@163.com', [to, ], msg.as_string())
server.quit()
"""
def send_email(to):
template = "要给{0}发送邮件".format(to,))
print(template)
user_input = input('请输入角色:')
if user_input == '管理员':
send_email('xxxx@qq.com')
elif user_input == '业务员':
send_email('xxxxo@qq.com')
elif user_input == '老板':
send_email('xoxox@qq.com')
(位置参数、关键字参数)