登录三次锁定

 1 count=0
 2 username="pangya"
 3 password="123456"  
 4 f=open('read.py','r')
 5 file=f.read()
 6 f.close()
 7 username=raw_input("input:")
 8 for i in range(1):
 9     if file==username:
10         print("The user has been locked up")
11         exit()
12     else:
13         continue
14 for i in range(3):
15     password1 = raw_input("input password:")
16     if password1 == password:
17         print('yes,you got it')
18     else:
19         print('password error..')
20     count+=1
21 if count==3:
22     print('sorry,your user is locked up')
23     f=open('read.py','w')
24     f.write('%s'%username)
25     f.close()

猜你喜欢

转载自www.cnblogs.com/pangya/p/9035272.html