首页 > 代码库 > 来个懂行得劈死我吧,不用给我留面子
来个懂行得劈死我吧,不用给我留面子
#usr_and pwd是用来存储有户名和密码的
usr_and_pwd = open(‘./usr_and_pwd.txt‘, ‘w‘)
#usr_in_lock 是用来存储被锁定用户的用户名的,三次输入有误,当前用户就会被锁定
usr_in_locked = open(‘./usr_in_locked.txt‘, ‘a‘)
for i in range(3):
#不知道这样写在python2.x中会不会有问题
usrname = raw_input(‘usrname:‘)
password = raw_input(‘password:‘)
#这个创建字典的方式也是很奇葩,回去查查书看再改
dic = [usrname:password]
#这里肯定错了,一个字典怎么可能在一个列表里,傻逼了,但不知道怎么写
if dic in list(usr_and_pwd):
print(‘Welcome usr %s login....‘, %usrname )
raw_input(‘ ‘)
break
else:
print(‘usrname or password is invalid, please get out and fuck off!!‘)
print(‘your account is locked for a few time, please retry it after 300s .‘)
#将被锁定的用户名记录进usr_in_locked
usr_in_locked.write(username)
usr_in_locked.close()
usr_and_pwd.close()
来个懂行得劈死我吧,不用给我留面子