Old boy Python Network Class-Day01 job-simulated login system, python-day01
Simulate the operations, condition statements, and loops of the main exercise files in the login System
Knowledge point:
1. str. strip ([chars]):
Delete all spaces at the front and back of the string. The chars parameter can be used to customize the characters to be deleted. Optional.
Input (). strip () can remove spaces when a user inputs to avoid unnecessary errors.
Usage:
Account = input ('Enter the account: '). strip ()
2. str. upper ()
Converts all lowercase letters in a string to uppercase letters.
Command = input ('Enter the command: '). strip ()
If command. upper () = 'A ':
Add_user (database)
This item is executed no matter whether the input command is A or.
3. dict. get (key)
Obtains the value corresponding to the key in the dictionary. If the key does not exist, None is returned,
If database. get (account) = None:
If the key does not exist, no error is reported.