将来的你会感谢现在努力的自己,骚年,趁年轻多努力学习 ------ Jasper_boy

python简单实现用户表单登录

实现简单的用户表单验证登录

user="desperado"
pwd="123456"


s=0
for i in range(10):
    if  s < 3:
        username = input("用户名:")
        password = input("密码:")
        if username == user and password == pwd:
            print("welcome,login successful")
            break
        else:
            print("username or password input error")
    else:
        con=input("rester input:")
        if con == 'y':
            s=0
            continue
        else:
            print("input error,exit...")
            break
    s += 1
View Code

 说明:循环10次,输入错误3次进行提示是否继续

posted @ 2016-11-08 15:28  Jasper_boy  阅读(1734)  评论(0编辑  收藏  举报