Login Interface---Python

Source: Internet
Author: User

Writing the Login interface

    • Enter User name password
    • Show welcome message after successful authentication
    • Three-time error after locking
1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 #author:orange 2018-01-24 Python 3.x4 #Login interface: Enter the user name password, after successful authentication display welcome information, the wrong 3 times after the lock. -----Multi-user password not resolved
5 6 ImportGetpass7_username ="Orange"8_password ="abc123"9Account_list = ["Orange"]TenLock_list = [] OneCount =0 A - whileTrue: -Input_username = input ("Username:") the - #determine whether the currently entered account is in the account list - ifInput_usernameinchaccount_list: - + #determine whether the currently entered account is in the Locked account list, and if so, prompt and exit. - ifInput_usernameinchlock_list: + Print("%s account is locked!"%input_username) A Break at Else: - #if the account password matches, display the login welcome information. -Input_password = Getpass.getpass ("Password:") - if_username = = Input_username and_password = =Input_password: - Print("Welcome User {name} login ...". Format (name=_username)) - Break in - #If the account password does not match, then prompts the error and the warning, the counter launches, enters 3 times the error to add the account number to the lock list. to Else: + Print("wrong password!") -Count + = 1 the Print("You enter the wrong password%s times!"%count) * Print("If You enter the wrong password 3 times, account would be lock!") $ ifCount = = 3:Panax Notoginseng lock_list.append (input_username) - the #The account is not in the list and the account is not indicated + Else: A Print("No {_name} account!". Format (_name = input_username))

Login Interface---Python

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.