Python List Dictionary Production roster management

Source: Internet
Author: User
Tags python list

1 #a list of business cards to store2Card_infors = []3 4 5 6 defPrint_menu ():7     #1. Print function Tips8     Print("="*50)9     Print("Business Card Management system")Ten     Print("1. Add a new business card") One     Print("2. Delete a name") A     Print("3. Modify a business card") -     Print("4. Query a business card") -     Print("5. Show All business cards") the     Print("6. Exit the system") -     Print("="*50) -  -  + defadd_new_card_infor (): -         """To complete the document entry:""" +New_name = input ("Please enter a new name:") ANEW_QQ = input ("Please enter the new QQ:") atNew_weixin = input ("Please enter a NEW:") -NEW_ADDR = input ("Please enter the address:") -  -         #define a new dictionary to store new business cards -New_infor = {} -new_infor['name'] =new_name innew_infor['QQ'] =NEW_QQ -new_infor["Weixin"] =new_weixin tonew_infor['Addr'] =new_addr +         Globalcard_infors - card_infors.append (new_infor) the  *  $ deffind_card_infor ():Panax NotoginsengFind_name = input ("Please enter the name you want to find:") -  theFind_flag = 0#not found by default +  A         Globalcard_infors the          forTempinchcard_infors: +             ifFind_name = = temp["name"]: -                Print("%s\t%s\t%s\t%s"% (temp['name'],temp['QQ'],temp['Weixin'],temp['Addr'])) $Find_flag=1 $                 Break -         ifFind_flag = =0: -             Print("no such person .") the  - defshow_all_infor ():Wuyi         """Show All information""" the         Print("name \tqq\t\t address") -         Globalcard_infors Wu          forTempinchcard_infors: -             #Print (temp) About             Print("%s\t%s\t%s\t%s"% (temp['name'],temp['QQ'],temp['Weixin'],temp['Addr'])) $  -  - defdel_card_infor (): -Del_name = input ("Please enter the name you want to find:") AFind_flag = 0#not found by default +          the         Globalcard_infors -          forTempinchcard_infors: $             ifDel_name = = temp["name"]: the Card_infors.remove (temp) theFind_flag = 1 the show_all_infor () the                  Break -         ifFind_flag = =0: in             Print("no such person .") the                  the  About defdel_modify_infor (): theModify_name = input ("Please enter the name of the information you want to modify:") theFind_flag =0 the  +         Globalcard_infors -          forTempinchcard_infors: the             ifModify_name = = temp["name"]:BayiModify_content = input ("Please enter the information you want to modify, such as NAME,QQ,WEIXIN,ADDR, etc.:") the                  forNameinchTemp.keys (): the                     Print("+"*50) -                     Print(Temp.keys ()) -                     Print("+"*50) the                     Print(name) the                     ifModify_content = =Name: theModify_value = input ("Please enter a value to modify:") theTemp[name] =Modify_value - show_all_infor () theFind_flag = 1 the                          Break the                     94         ifFind_flag = =0: the             Print("no such person .")           the  the 98  About  - defMain ():101         """complete control of the entire program."""102     103 Print_menu ()104          whileTrue: the             #2. Get the user's input106num = Int (input ("Please enter the operation number:"))107 108             #3. Perform the corresponding functions according to the user's data:109             ifnum = = 1: the add_new_card_infor ()111             elifnum = = 2: the del_card_infor ()113             elifnum = = 3: the del_modify_infor () the             elifnum = = 4: the find_card_infor ()117             elifnum = = 5:118 show_all_infor ()119             elifnum = = 6: -                  Break121             Else:122                 Print("input Error, please re-enter:")123  124  the 126 #calling the main function127Main ()

Python List Dictionary Production roster management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.