标签:
本文主要实现:登录,三次输入错误后自动退出
代码:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
count=0
while count<3:
user=raw_input(‘please input your username:‘)
pwd=raw_input(‘please input your password:‘)
if user==‘lh‘ and pwd==‘123‘:
print ‘Success!‘
break
else:
count+=1
if count<3:
print ‘Please input again!‘
if count==3:
print ‘Too many times!‘
运行结果:
标签:
原文地址:http://www.cnblogs.com/pythonlh/p/5725204.html