Implementation of user management system in Python
This example shares the specific code of Python User management system for your reference. The specific contents are as follows
"Python core programming" Chapter 7 exercise question 5
1、 Title Description
userpw2. py。 The following questions are related to the management name password key value pair data program in example 7.1.
(a) Modify that script, Enables him to record the user's last login date and time (use time module) and save it together with the user password. The program interface requires the user to enter the prompt of user name and password. No matter whether the user name logs in successfully or not, there shall be a prompt. After the user logs in successfully, the last login time stamp of the corresponding user shall be updated. If the time difference between this login and the last login is no more than four hours, the user shall be notified: “You already in at :
”。
(b) Add a management menu with the following two items: (1) delete a user (2) display the list of names and passwords of all users in the system.
(c) The password is currently not encrypted. Please add a code to encrypt the password
(d) Add a graphical interface to the program, for example, with Tkinter. (the development of graphical interface is complex, which is not used here.)
(e) User names are required to be case sensitive.
(f) strengthen the restrictions on user names and do not allow symbols and whitespace characters.
(g) Merge the two options of "new user" and "old user". If a new user attempts to log in with a nonexistent user name, ask whether the user is a new user. If yes, create the user. Otherwise, log in as an old user.
2、 The modules used in the program are explained as follows:
(1) re: regular expression engine, method of calling regular expression in Python.
(2) Pickle: object persistence, writing data to disk
(3) Datetime: time processing, used to record the user login time stamp
(4) Base64: base64 encryption module
(5) Hashlib: hash encryption module
Full code:
For more learning materials, please pay attention to the special topic "management system development".