#输入账号密码#保存在文件内#输错超过3次,下次再登录,也无法登陆
choose =input("Do you want to sign up or login?\nIf you want to sign up,press 'S'.\nIf you want to login,Press 'L'\n").lower()# To create a new account.while choose !='s':
choose =input("Do you want to sign up or login?\nIf you want to sign up,press 'S'.\nIf you want to login,Press 'L'\n").lower()else:file=open("keys.txt","w")
account =input("Enter your account number.\n")+"\n"
keys =input("Enter your key.\n")file.write(account)file.write(keys)file.close()print("Your account has been created.")# To login.
choose =input("Logining is the only one choose,Press 'L'\n").lower()while choose !='l':
choose =input("Logining is the only one choose,Press 'L'\n").lower()else:
wrong_count =0while wrong_count<3:
enter_account =input("Enter your account number.\n")
enter_key =input("Enter your key.\n")file=open("keys.txt","r")
value =list(file.readlines())file.close()if value[0]== enter_account and value[1]== enter_key:print("Your voucher is right.")breakelse:
wrong_count +=1print("It is not right.That is Over.")continue
\n & /n不要打错字符串使用+而不是append方法read函数返回字符串,readlines返回列表#输入账号密码#保存在文件内#输错超过3次,下次再登录,也无法登陆choose = input("Do you want to sign up or login?\nIf you want to sign up,press 'S'.\nIf you want to lo...