具有创建帐户扩展名的登录系统的作业分配。
我尝试了许多不同的尝试,但无济于事。
valid = True
while valid:
try:
x = input("Do you want to Login (A) or Create account (y)?")
if x == y:
file = open("database.txt", "r")
username = input("Enter a username :")
password = input("Now enter a password :")
print("Your username is", username,".")
file = open("database.txt","a")
file.write (username)
file.write (",")
file.write (password)
file.write("\n")
file.close()
else:
username = input("Enter your username")
我希望它能够执行该功能,但不知道为什么它不起作用。