标签:输入密码 int usr odi not bin input count utf-8
#!/usr/bin/env python
#_*_ coding:utf-8 _*_
dic={
‘yts‘:{‘password‘:‘123‘,‘count‘:0},
‘nick‘:{‘password‘:‘123‘,‘count‘:0},
‘test‘:{‘password‘:‘123‘,‘count‘:0},
}
while True:
name=input(‘请输入用户名: ‘)
if not name in dic:
print(‘用户不存在‘)
continue
if dic[name][‘count‘] > 2:
print(‘尝试过多,锁定‘)
continue
password=input(‘请输入密码: ‘)
if password == dic[name][‘password‘]:
print(‘登录成功欢迎用户%s‘ %name)
break
else:
print(‘用户名或密码错误‘)
dic[name][‘count‘]+=1
标签:输入密码 int usr odi not bin input count utf-8
原文地址:http://www.cnblogs.com/tianlive/p/7496896.html