验证密码

# !/usr/bin/env python
# _*_conding:utf-8_*_

count = 0
black_list = []
user = input("用户名 :")

f = open('pw.user.txt','r',encoding='utf-8')
data = f.readlines()
f.close()



for i in data:
line = i.strip('\n').split()
if user in line:
print('锁定了')
exit()

else:
while count < 3 :
passwd = input('pw : ')
f1 = open('aaa.txt', 'r')
data1 = f1.readlines()
f.close()
for j in data1:
line1 = j.strip('\n').split() #转成列表的形式去匹配位置。。
print(line1)


if user == line1[0] and passwd == line1[1]:
print("欢迎欢迎热烈欢迎")
exit()

else:
print("账号密码不对")
count += 1


else:
if count == 3 :
print("账号已经被锁定")
f = open('pw.user.txt', 'a+', encoding='utf-8')
f.write('%s' %user)
f.close()
posted @ 2017-07-13 14:52  骑着蜗牛溜小二  Views(226)  Comments(0)    收藏  举报