#Author:zhanghonglin counter = 0 #确定真实用户名和密码 real_name = "itssky" real_password = "itssoft" #读取黑名单 f = open ( "black_user" , "r" ) lock_file = f.read() f.close() user_name = input ( "请输入您的用户名:" ) #判定是否是黑名单用户 for i in range ( 1 ): if user_name == lock_file: print ( "对不起,你的账户被锁定,无法登陆!" ) exit () else : continue #判定登陆次数 for i in range ( 3 ): password = input ( "请输入您的密码:" ) if password == real_password: print ( "登陆成功!" ) break else : print ( "登陆失败!" ) counter += 1 if counter == 3 : print ( "对不起!您的错误输入已达三次,即将锁定账户。" ) f = open ( "black_user" , "w" ) f.write( "%s" %user_name) f.close()
登陆验证,密码输错三次,锁定用户
原创
©著作权归作者所有:来自51CTO博客作者火达客9的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章