Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use list list to realize CRUD operation function in Python

Shulou Source: shulou.com Published: 2022-05-31 10:45:21 09月16日 Update

This article mainly introduces the Python how to use the list list to achieve CRUD operation function related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe everyone in this Python how to use the list list to achieve CRUD operation function article will have a harvest, let's take a look.

The requirements are as follows:

1. Interface list

Welcome to user management system 1 add user 2 delete user 3 modify user 4 query user 5 exit

two。 Delete, modify, query, operate according to id

3. Items that are not deleted, modified or queried are given the corresponding hints, and the results of the operation are given as hints.

4. Initialize 3 users

5. The user has an attribute id,name,password, which uses three lists to save data.

The code is as follows:

# user management system # initialize 3 users ids = ['1 'root','abc123''] names = ['Zhang San','Li Si', 'Wang Wu'] pws = ['root','abc123'' '123456'] # create menu print ("= Welcome to user management system = =") print ("1 add user") print ("2 delete user") print ("3 modify user") print ("4 query user") print ("5 exit") type = int ("Please select:") while type > = 1 and type

Tags: User input prompt query function success name password mark value knowledge management system system management content article selection code value attribute simple operation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MariaDB NVidia Microsoft Shulou Information