zoukankan      html  css  js  c++  java
  • pthon自动化之路编写登录接口

    # Author:Lixiang Zou
    lock = "F:/Users/admin/PycharmProjects/day1/account.txt"
    account = "F:/Users/admin/PycharmProjects/day1/account_lock.txt"

    count = 0
    flag = 1
    lock_user = []

    f1 = open(lock, 'r')
    lock_file = f1.readlines()
    f1.close()
    for i in lock_file:
    i = i.strip('\n')
    lock_user.append(i)

    f2 = open(account, 'r')
    account_file = f2.readlines()
    f2.close()

    while True:
    name = input("input your name:")
    passwd = input("input your password:")
    if name in lock_user:
    print("user is lock!")
    break
    else:
    count += 1
    for i in account_file:
    n1, p1 = i.strip().split()
    if name == n1 and passwd == p1:
    print("welcome login!!")
    flag = True
    else:
    continue
    if flag is True:
    break
    else:
    if count > 2:
    print("错误三次")
    with open(lock, 'a') as f:
    f.write("\n" + name)
    break
  • 相关阅读:
    20210603
    20210602
    20210601
    20210531-已编辑
    2021053101
    操作系统笔记(一)
    尘埃落定,扬帆起航
    RTL级低功耗设计
    关于毛刺
    电路级拾珍
  • 原文地址:https://www.cnblogs.com/zoulixiang/p/8295302.html
Copyright © 2011-2022 走看看