Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report