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!"