def runlogin():
if choice1 == "yes":
username=input("Enter your username")
password=input("Enter your password")
file = open("logins.txt","r")
if (file.readline()) == (username+":"+password):
print("Access Granted")
else:
print("Access Denied")
print("Welcome")
choice1=input("Have you already created an account? ('yes' or 'no')")
choice1=choice1.lower()
if choice1 == "no":
createusername=input("Please enter a username")
createpassword=input("Please enter a password")
filefile=open("logins.txt","a")
filefile.write(createusername+":"+createpassword)
print("Account created, redirecting to login page")
filefile.close()
if choice1 == "yes":
runlogin()
当用户选择“否”时,系统会提示他们创建帐户。 我的问题是,当他们输入自己的详细信息,然后创建帐户时,文本文件中没有添加任何内容
文本文件的格式如下“username:password““
没有语法错误发生
目前没有回答
相关问题 更多 >
编程相关推荐