#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author "Sniper"
import getpass
import os
### Registry Account 注册用户,将用户数据存入文件中
print(
"Welcome to the Registry System!\n\n\n")
username = input(
"Please Input Your UserName:")
password = input(
"Please Input Your Password:")
password2 = input(
"Please Verify Your Password:")
if password ==
password2 :
userfile = open(
"username.txt",
"w+", encoding=
"UTF-8")
passfile = open(
"password.txt",
"w+", encoding=
"UTF-8")
userfile.write(username)
passfile.write(password)
userfile.flush()
passfile.flush()
userfile.seek(0)
passfile.seek(0)
userfile.close()
passfile.close()
else:
print(
"Your Password Is Not Matched ,Check Your Input!")
exit()
cls = os.system(
"cls")
####Login System 登录用户,判断登录信息是否正确
usr = open(
"username.txt")
psd = open(
"password.txt")
UserName =
usr.read()
PassWord =
psd.read()
count = 3
while True :
print(
"++++++++++++++++++++++++++++++++++++++")
print(
"+++ Welcome To The Alauda System +++")
print(
"++++++++++++++++++++++++++++++++++++++")
yourusername = input(
"Please input your username:")
yourpassword = input(
"Please Input your password:")
if UserName == yourusername
and PassWord ==
yourpassword :
print(
"Welcome {name} login ...".format(name=
username))
break
else :
print(
"Please input the true username or password !\n")
print(
"You lose 1 chance , Now you have {counts} chances\n".format(counts=count -1
))
count -= 1
if count ==
0 :
print(
"Uh-huh !!! You have been used up Your chances. Your account will be locked!!!\n")
exit()
usr.close()
psd.close()
转载于:https://www.cnblogs.com/Sniper-tech-share/p/9857829.html
转载请注明原文地址: https://mac.8miu.com/read-22145.html