zoukankan      html  css  js  c++  java
  • python 小程序练习

    还有一些小bug

    基本有

    输入用户名密码

    认证成功后显示欢迎信息

    输出三次后锁定

    # -*- coding:utf-8 -*-
    account_file=('C:UsersguiguDesktopuser.txt')
    lock_file=('C:UsersguiguDesktoplock.txt')
    f = file(account_file)
    account_list = f.readlines()
    f.close()
    while True:
        f = file(lock_file)
        lock_list=[]
        for i in f.readlines():
            line = i.strip('
    ')
            lock_list.append(line)
        f.close()
        loginSuccess = False
        username=raw_input("username:").strip()
        if username in lock_list:
            print "sorry,you are already in the block list,get the fuck out!"
            break
        for line in account_list:
            line=line.split()
            if line[0] == username:
                for i in range(3):
                    password = raw_input('password:').strip()
                    if password == line[1]:
                        print "welcome %s login my system" % username
                        loginSuccess = True
                        break
              

              else:
                print "password error"


    else: f =file(lock_file,'a') f.write('%s ' %username) f.close() print "entered,3 times of wrong passwd,going to lock %s" % username if loginSuccess == True:break if loginSuccess == True:break
  • 相关阅读:
    windows ntstatus.h 头文件
    Android Q 后台启动 Activity
    windows 删除文件夹所有文件夹及文件代码
    Android 加壳App Demo
    Android App 签名保护demo
    RXAndroidBle 记录网址
    c++ windows 获取系统时间
    js 代码保存
    day33 ansible
    day31 综合实时同步服务
  • 原文地址:https://www.cnblogs.com/guigujun/p/6122720.html
Copyright © 2011-2022 走看看