python3.0 Analog User Login, three error lockout

Source: Internet
Author: User

Tag:python3.0    lock     User login    

# -*- coding:utf-8 -*-#需求模拟用户登录, more than three error locks are not allowed to login Count = 0#realname passwdreal_ username =  "test" real_password =  "test" #读取黑名单的内容f  = open (' Black_user ', ' R ') lock_ File = f.read () F.close () username = input (' Enter user name: ') #判断输入用户是否在黑名单内, if the password is not allowed For i  in range (1):    if lock_file == username:         print (' Sorry, your user is locked, temporarily not allowed! ')         exit ()     else:         continue# attempts to enter a password and count the number of inputs For i in range (3):     Password = input ("Please enter password:")     if Username == Real_Username  And password == real_password:        print ("Login Successful")         break    else:         print ("Login Failed")     count += 1# If you enter the wrong password three times, the user name is prompted to lock, and the user name If count == 3:    print ("Sorry, you have entered the wrong number of passwords has reached 3 times, Your user name is locked ")     f = open (" Black_user "," W ")     f.write ("%s "% Username)     f.close ()


This article is from the "Dr Small White" blog, please be sure to keep this source http://metis.blog.51cto.com/1203503/1963377

python3.0 Analog User Login, three error lockout

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.