count
=
0
Real_Username
=
"test"
Real_Password
=
"test"
f
=
open
(
'black_user'
,
'r'
)
lock_file
=
f.read()
f.close()
Username
=
input
(
'请输入用户名:'
)
for
i
in
range
(
1
):
if
lock_file
=
=
Username:
print
(
'对不起,您的用户已锁定,暂时不允许使用!'
)
exit()
else
:
continue
for
i
in
range
(
3
):
Password
=
input
(
"请输入密码:"
)
if
Username
=
=
Real_Username
and
Password
=
=
Real_Password:
print
(
"登录成功"
)
break
else
:
print
(
"登录失败"
)
count
+
=
1
if
count
=
=
3
:
print
(
"对不起,您输入的密码错误次数已经达到3次,您的用户名将被锁定"
)
f
=
open
(
"black_user"
,
"w"
)
f.write(
"%s"
%
Username)
f.close()