Business card management system (python,

Source: Internet
Author: User

Business card management system (python,

The example in this article shares the code of the python business card management system for your reference. The details are as follows:

Import oslist_all = [] def page (): "output Homepage" print ("*" * 30) print ("Welcome to [business card management system] v2.0 ") print () print ("1. new business card ") print (" 2. view All ") print (" 3. query business cards ") print (" 4. save information ") print (" 0. exit System ") print (" = "* 30) def new_cards ():" "Save the information received from the user to the dictionary" dict_1 = {"name ": input ("name:"), "age": input ("age:"), "phone": input ("Tel:"), "email ": input ("Email:")} # Add the dictionary to the list_all.append (dict_1) def check_all () List (): "print all dictionary information" if len (list_all)> 0: print ("Name \ t age \ t phone \ t mailbox") for I in list_all: print ("% s \ t % s" % (I ["name"], I ["age"], I ["phone"], I ["email"]) else: print ("No information available") def check_cards (): "query business card" user = input ("Enter the name to be queried:") for I in list_all: # traverse the global list, extract the stored dictionary in sequence if I ['name'] = user: # If the dictionary value is the same as the value searched by the user, print the dictionary ("Name \ t age \ t phone \ t mailbox ") print ("% s \ t % s" % (I ["name"], I ["age"], I ["phone"], I ["email"]) revise_cards (I) else: print ("No information found") def revise_cards (dict_1 ): "Modify the business card and receive the dictionary you have previously found" while True: user_choor = input ("1. modify business card 2. delete business card 0. return to the main menu ") if user_choor =" 1 ": # if you enter 1 to execute the print (" Modify the business card, note: Enter the modification content directly, and press Enter not to modify ") dict_1 ["name"] = revise (dict_1 ["name"], input ("name") dict_1 ["age"] = revise (dict_1 ["age"], input ("Age") dict_1 ["phone"] = revise (dict_1 ["phone"], input ("phone ")) dict_1 ["email"] = revise (dict_1 ["email"], input ("email") print ("modified successfully ") break # laturn elif user_choor = "2": # If you enter 2 to delete the dictionary list_all.remove (dict_1) print ("") break elif user_choor = "0 ": break else: print ("incorrect input. Please try again") def revise (old, new): "function" if len (new) <= 0: return old else: return newdef save_dir (): "" save the file to the specified file "a = open (" 123.xlsx "," w "). write (str (list_all). close () print ("saved successfully") def read_dir (): "Read File" if OS. path. exists ("123. "data"): a = open ("123. data "," r ") B = eval (. read () global list_all = B. close () import cards_tools # Read the file cards_tools.read_dir () while True: cards_tools.page () user_input = input ("select the operation you want to perform") if user_input = "1 ": print ("coming soon: New Business card") cards_tools.new_cards () elif user_input = "2": print ("coming soon: View All") cards_tools.check_all () elif user_input = "3": print ("coming soon: querying business cards") cards_tools.check_cards () elif user_input = "4": print ("coming soon: saving information ") cards_tools.save_dir () elif user_input = "0": print ("welcome to use [business card management system]") exit () else: print ("your input is incorrect, enter ")

For more information, see management system development.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.