标签:登录 for 登陆 认证 read break 成功 代码 ack
编写登陆接口
代码如下:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
count = 0
name = "hx"
passwd = "123"
f = open (‘user_black‘,‘r‘ )
lock_file = f.read()
f.close()
name = input("请输入用户名:")
for i in range(1):
if lock_file == name:
print ("sorry,锁定了")
exit()
else:
continue
for i in range(3):
passwd = input("请输入密码:")
if passwd == "123":
print ("welcome")
break
else:
print ("登录失败!")
count += 1
if count == 3:
print("用户已锁定")
f = open (‘user_black‘,‘w‘ )
f.write(‘%s‘%name)
f.close()
标签:登录 for 登陆 认证 read break 成功 代码 ack
原文地址:http://www.cnblogs.com/losers/p/6565782.html