try: f = open('jilu.txt','r') context = f.read() print context except: print 'you need to check in 3 times' for i in range(3): name = raw_input('Please input your name:') password = raw_input('Please input your password:') if name == 'hill' and password == '123456': print 'congratulations! welcome to this!' break else: print 'sorry,your name or password is wrong! please try again' if i == 2: f = open('jilu.txt','a+') f.write('your account is not used') f.close() break
python小练习之登录程序,登录三次错误之后锁定账户
原创文章标签 python;login;lock 文章分类 Python 后端开发
©著作权归作者所有:来自51CTO博客作者醉我红尘的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
乌班图查看运行的java 乌班图如何查看ip
在终端输入:ifconfig -a即可得解。出来的结果inet后就是你的ip地址
乌班图查看运行的java ip地址