Python diary, simple password login

Source: Internet
Author: User

# readme:# blogger Address:www.cnblogs.com/ne-zha# ne_zha# Requirements: # Write Login Interface #1. Enter user name password #2. Login successful display welcome message #3Error three lock Lock_file=open ('File_lock.txt','R') User_pass=open ('Username_file.txt','R') cmd=int(Input (" "Login System input 1 exit System input 2 Please enter the operation:" "))ifcmd = =2: Exit () elif cmd==1: Username= Input ("Please input your user ...")     forIinchRange3):         forIinchlock_file.readlines (): I=I.split ()ifUsernameinchi[0]: Print ('Sorry,%s is locked'%username) exit () match=False forJinchuser_pass.readlines (): user,passwd=J.split ()ifUsername = =User:password=input ("Please input the passwd")            ifPassword = =Passwd:print ("Login Successful! ") Match=True Breakelif Password!=passwd: forNinchRange2): Password=input ("password error, please re-enter! ")                    ifPassword = =Passwd:print ("Login Successful! ") Match=True Break    ifUsername! =User:print ("user name does not exist! ") exit ()ifMatch = =False:print ("three input errors, account to be locked! ") Lock_file.write ('%s \ n'%username) lock_file.close () User_pass.close () exit ()

Python diary, simple password login

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.