当前位置:天才代写 > tutorial > Python教程 > python编写登录接口

python编写登录接口

2018-05-17 08:00 星期四 所属: Python教程 浏览:557

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

 

    关键字:

天才代写-代写联系方式