Python Login Verification Applet script
Flowchart of the Script program:
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/07/0D/wKiom1nCeNCAsa6IAACoBPQQFeE791.png "title=" Login program flowchart. png "width=" 660 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:660px;height:300px; "alt=" Wkiom1ncencasa6iaacobpqqfee791.png "/>
#!/usr/bin/env python# _*_ coding:utf-8 _*_# Enter the above line to recognize the Chinese character annotation ## --------------------- ----------------------------------------------------------# filename: login.py# revision: 1.0# date: 2017/09/ 20# author: xad# email: [email protected]# website: http://onenice.blog.51cto.com/# description: check login# notes: ~# ------------- ------------------------------------------------------------------# copyright: 2017 (c) xad# license: gplimport sysusername = ' XAD ' password = ' xad123 ' retry_counter = 0#login_status = ' NO ' login_status = ' YES ' # Use this to simulate whether the user is online ## login verification part #while retry_counter <3 : Exit # #当retry_counter more than 3 times user = raw_input (' Username: '). Strip () if len (user) ==0: # Verify that the input user is empty, then continue the loop, otherwise enter the next validation input #print "error : username cannot be empty!" Continue passwd = raw_input (' Password: '). Strip () if len (passwd) == 0: #验证输入密码是否为空, is to continue the cycle, otherwise jump out of the loop #print "error : password cannot be empty! " continue else:if user == username and passwd == password: #验证用户密码是否都正确, it's all right to allow login! # if login_status == ' YES ': sys.exit (' Sorry , user %s has been logining! ' % user ) else: sys.exit (' welcome %s logining to system! ' % user ) else: #retry_counter = retry_counter + 1 retry_ counter += 1 print ' wrong username or password, please Verify your username or password ! \nonly %s more chances! ' % (3 - retry_counter )
Python Login Verification Applet script