标签:write name col while dmi python rto login put
1 #!/usr/bin/env python 2 # *_* coding:utf-8 *_* 3 # python learning, keep on! 4 count=0 5 while count <3: 6 username = input(‘username:‘) 7 password = input(‘password:‘) 8 userlock=[] 9 for i in open(‘lockuser.txt‘,‘r‘): 10 userlock.append(i.strip(‘\n‘)) 11 if username in userlock: 12 print(‘your username has locked! please contact administrator.‘) 13 break 14 else: 15 user=[] 16 for j in open(‘user.txt‘,‘r‘): 17 user.append(j.strip(‘\n‘)) 18 up=username+‘:‘+password 19 if up in user: 20 print(‘wellcome ‘+username+‘ login!!‘) 21 break 22 else: 23 count+=1 24 print(‘Invalid username or password, your try ‘+str(count)+‘ times‘) 25 else: 26 print(‘too many time you try ,we locking your username.‘) 27 usertolock=open(‘lockuser.txt‘,‘a‘) 28 usertolock.write(username+‘\n‘) 29 usertolock.close()
标签:write name col while dmi python rto login put
原文地址:http://www.cnblogs.com/c0ldwind/p/7750682.html