#coding: Gbk#author:zhbimport getpass,os,sysos.system (' cls ') i=0while i<3:name=raw_input (' Enter user name: ') lock_file= Open (R ' account_lock.txt ', ' r+ ') for Lock_line in Lock_file.readlines (): Lock_line=lock_line.strip (' \ n ') if Lock_line==name:sys.exit (' user%s ' exists in the locked file! Please login to operation and maintenance platform again! '%name) Else:pass User_file=open (r ' Account.txt ', ' R ') for User_line in User_file.readlines (): (User,password) =user_line.strip (' \ n '). Split () If user==name:j=0 while J<3:passwd=getpass.getpass ("Input password:") if pas Sword==passwd:sys.exit ("Warmly welcome%s into operation and maintenance platform"%name) else:if j!=2: Print ("Password input error, user%s has%d input opportunity"% (NAME,2-J)) J+=1 else: #密码输错3次, locked and appended to Account_lock.txt Lock_file.write (name+ ' \ n ') sys.exit ("The account%s has been locked since the password was entered 3 times, please contact the IT staff to unbind"%name) Else:pass i+= 1else:sys.exit (' User not present in system '%s, please log back in '%name ')