您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在Python中从一个函数调用变量到另一个函数

在Python中从一个函数调用变量到另一个函数

您将需要在辅助函数中返回值并从主send_email()函数调用这些函数,并将返回的值分配给变量。像这样:

def get_email_address():
    #the code to open up a window that gets the email address
    Email = input
    return Email

def get_email_username():
    #the code to open up a window that gets email username
    Email_Username = input
    return Email_Username

#same for the email recipient and email password

def send_email():
    # variables from the other def's
    email_address = get_email_address()
    email_username = get_email_username()

    #code to send email
python 2022/1/1 18:48:09 有345人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶