其他分享
首页 > 其他分享> > 编写登录接口

编写登录接口

作者:互联网

# -*- coding:utf-8 -*-
# Author:WuGui Xiao
import getpass,sys
'''
  python基础编写登录接口
''' _username = "xiaowugui" _password = "Test123" def user_login(_username,_password): for i in range(3): ''' getpass.getpass() -- 显示提示字符串,关闭键盘屏幕回显,然后读取密码 --- 加密(在交互式命令行中使用) ''' username = input("please enter username:") password = getpass.getpass("Please enter password:") if username == _username and password == _password: print(f"Welcome user {username} login success!!") sys.exit() else: if i == 2: print("User has been locked for 30 seconds..!") else: print("wrong user name or password.") user_login(_username,_password)

 

标签:username,登录,接口,getpass,user,print,编写,login,password
来源: https://www.cnblogs.com/wang1yi1xian1/p/14382011.html