Python登入驗證小程式指令碼

來源:互聯網
上載者:User

標籤:python指令碼 登入驗證程式 流程圖

Python登入驗證小程式指令碼

指令碼程式流程圖:

650) this.width=650;" src="https://s2.51cto.com/wyfs02/M00/07/0D/wKiom1nCeNCAsa6IAACoBPQQFeE791.png" title="登入程式流程圖.png" width="660" height="300" border="0" hspace="0" vspace="0" style="width:660px;height:300px;" alt="wKiom1nCeNCAsa6IAACoBPQQFeE791.png" />

#!/usr/bin/env python# _*_ coding:utf-8 _*_#輸入以上一行才可以識別中文字元注釋## -------------------------------------------------------------------------------# 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‘#用這個來類比使用者是否已線上## login verification part #while retry_counter <3 :#當retry_counter 大於3次則退出#  user = raw_input(‘Username:‘).strip()  if len(user) ==0:  #驗證輸入使用者是否為空白,是則繼續迴圈,否則進入下一步驗證輸入#print "ERROR : Username cannot be empty!"continue  passwd = raw_input(‘Password:‘).strip()  if len(passwd) == 0:  #驗證輸入密碼是否為空白,是則繼續迴圈,否則跳出迴圈#print "ERROR : Password cannot be empty!"  continue  else:if user == username  and  passwd == password:#驗證使用者密碼是否都正確,都正確才允許登入!#   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登入驗證小程式指令碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.