Accompanied by a flowchart can be seen, the first painting will slowly improve.
The code is as follows:
1.User User Name Store file
Wang 2,123 Zhang 31,234 Li 4,123,456
2.lock_user Locked User files
3. land.py Main Program Files
sysi=i<: () account = () /user account input Lock_list = (,) / Open lock file (read and write) lock_user = lock_list.readlines () /extract the retrieved information into List User_list = () user = user_list.readlines () Lock_line Lock_user: lock_line = lock_line.strip () /remove \ n characters, extracting available information account == Lock_line: sys.exit (% account) User_ account user: /separate user name, password (User,password) = user_account.strip (). Split () account == User: /Account matching Cycle j = j < : passwd = () (passwd) == Password: (% account) sys.exit () : j!=: (% (account,-j)) j = j+: lock_list.write (account + ) /password match failed, lock account sys.exit (% account) : /account does not exist first pass, more than three exit system : i!=: (% ( account,-i)) i +=: sys.exit (% account ) Lock_ List.close () User_list.close ()
Python writes user Login interface