NameError: name 'blank' is not defined

NameError: name 'blank' is not defined

我正在输入一个代码,其中保存了我所有不同帐户的所有帐户信息,这样如果我忘记了,我可以 运行 这个代码并找到它。

但是,我不断收到一条错误消息,指出未定义 AccountInfo。我已经尝试了很多东西并查看了很多论坛,但我似乎无法弄清楚我做错了什么。

你能帮帮我吗?我已经删除了 "AccountInfo" 的几乎所有代码,因为我不想放置该信息。

def Main():
myUsername = input("What is the username? (Case sensitive)")
if(myUsername == "Brandon13"):
    myPassword = input("What is the password? (Case sensitive)")
    if(myPassword == "13Dominators4JC!"):
        AccountInfo()
    else:
        print("I'm sorry! You entered incorrect information!")
        Main()
else:
    print("I'm sorry! You entered incorrect information!")
    Main()  

Main()      


def AccountInfo():
    myAccount = input("Which account information would you like access to? (Case sensitive)")

在您的代码中,首先声明 Main 函数。然后调用 Main 函数,它在定义之前调用 AccountInfo 函数。 然后 声明 AccountInfo 函数。

将 AccountInfo 函数移到代码顶部以解决问题。