Job Flow chart:
Requirements Code:
1 #!/usr/bin/env python2 #-*-Coding:utf8-*-3f = open ('d:/study/day1/day1-Job/lock.txt','R')4Name =list ()5 forLineinchf.readlines ():6line =Line.strip ()7 if notLen (line)orLine.startswith ('#'):#determine if it is a blank line or comment line8 Continue9Name.append (line)#SaveTen f.close () OneLogin_name ='Root' ALogin_password ='[email protected]' -Time = 1 - whileTime <= 3: thePrint_name = input ('Please enter your login username:') -Print_password = input ('Please enter your login password:') - ifPrint_nameinchName: - Print('This user has been locked out! ') + exit () - ifPrint_name = = Login_name andPrint_password = =Login_password: + Print('welcome into this system! ') A Break at Else: - ifTime = = 3: - Print('you have entered too many errors and are locked! ') -f = open ('d:/study/day1/day1-Job/lock.txt','a') -result ='\ n'+Print_name - f.write (Result) in f.close () - Break to Else: + Print('the user name or password you entered is incorrect, and you have%d chances to reenter it:'% (3-Time )) -Time + = 1 the Continue
Day1:: (python-Learning Path)-Process control and document reading and writing