Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:The Machinist time:18-9-14
count = 0
_username = 'zhang'
_password = '123456'
f = open('blacklist.txt', 'r')
lock_name = f.read()
f.close()
F = open('word.txt', 'r')
lock_password = F.read()
F.close()
while count < 3:
username = input("username:")
password = input("password:")
if _username == username and _password == password:
print("欢迎登录")
break
elif lock_name == username and lock_password == password:
print("对不起,你的用户名及密码已锁定")
else:
print("登录失败")
count += 1
if count == 3:
print("对不起,输入超过三次,用户名密码锁定")
f = open('blacklist.txt', 'a')
f.writelines(username)
f.close()
F = open('word.txt', 'a')
F.writelines(password)
F.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment