python编写登录接口
当前位置:以往代写 > Python教程 >python编写登录接口
2019-06-14

python编写登录接口

python编写登录接口
python">#!/usr/bin/env python
# -*- coding:utf-8 -*-

import getpass

logintimes = 0
while logintimes < 3:
    name=raw_input("Please input your username:")
    pwd=getpass.getpass("Please input your password:")
    if name=='wxy' and pwd=='123':
        #正确后允许进入并退出循环
        print "Welcome,login succeed!"
        break
    else:
        #错误时,出错计数加1
        print "Error,login again:"
        logintimes+=1
else:
    #错误达到三次后,结束此循环
    print "Sorry,account has been locked!"

标签:python

    关键字:

在线提交作业