Home  >  Article  >  Backend Development  >  Job login interface summary

Job login interface summary

巴扎黑
巴扎黑Original
2017-06-23 15:01:531117browse

Assignment 1: Write login interface

1. Enter username and password

2. The welcome message is displayed after successful authentication

3. Lock after three incorrect entries

Above In the homework, several ideas were used to solve the problem; but in essence they are all the same; the core is the operation of files, the addition, deletion, modification and search of files; and these operations require the use of strings, lists and dictionaries.

In the code, we used the following operations:

(1) String operation, " ".join(list), character Strings and lists are concatenated to form a new string, which is used as the file information of the rows in the list;

(2) Splicing of extend() lists, two lists list1.extend(list2);

(3) Adding color to the output \033 [23;1m \033[0m, this is the case of adding color to the output;

(4) The ordered dictionary (OrderedDict) in the collections module. When we read a file into a dictionary, because the dictionary is unordered, this will cause confusion and cannot be sorted in the previous order of the file. We can Use an ordered dictionary to solve this problem;

(5) Use of continue. Continue is to end this loop and execute the next loop. When we find that the conditions are not met, If you need to end the current loop, and if you need the program to continue executing from the beginning without interrupting, you can use continue to operate;

(6) while...else...if condition If the condition is met, the code after while will be executed. If the condition is not met, the code after else will be executed.

(7) strip() clears blanks, split() separates strings;

(8) exit() in sys module Exit the program;

(9) os.path.exists(filename) method in the os module to determine whether the file exists.

The above is the detailed content of Job login interface summary. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn