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()
当用户选择“否”时,系统将提示他们创建一个帐户。 我的问题是,当他们输入详细信息然后创建帐户时,什么都没有添加到文本文件中
文本文件的格式类似于“用户名:密码”
没有语法错误