Python login interface (1) and python login interface

Source: Internet
Author: User

Python login interface (1) and python login interface
Job: contains the following content: zhangbin 123zhb 456 jack 122lock file account_lock.txt is empty by default # coding: gbk # author: zhbimport getpass, OS, sysos. system ('cls') I = 0 while I <3: name = raw_input ('input Username: ') lock_file1_open(r'account_lock.txt', 'r + ') for lock_line in lock_file.readlines (): lock_line = lock_line.strip ('\ n') if lock_line = name: sys. exit ('USER % s exists in the locked file! Log on to the O & M platform again! Goodbye! '% Name) else: pass user_file1_open(r'account.txt', 'R') for user_line in user_file.readlines (): (user, password) = user_line.strip ('\ n '). split () if user = name: j = 0 while j <3: passwd = getpass. getpass ("input password:") if password = passwd: sys. exit ("warmly welcome % s to the O & M platform" % name) else: if j! = 2: print ("Incorrect password, USER % s still has % d chance to enter" % (name, 2-j) j + = 1 else: when the primary key is lost 3 times, the lock_file.write (name + '\ n') sys is locked and added to account_lock.txt. exit ("this account % s has been locked due to three consecutive password input errors. Please contact IT staff to unbind" % name) else: pass I + = 1 else: sys. exit ('user % s does not exist in the system. Please log on again '% name)

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.