Пример #1
0
def main():

    while True:
        # 显示功能菜单
        cards_tools.show_menu()

        number = int(input("请选择希望执行的操作:"))

        if number == 1:

            print("您选择的操作是「新建名片」")
            cards_tools.new_card()

        elif number == 2:

            print("您选择的操作是「显示全部」")
            cards_tools.show_all()

        elif number == 3:

            print("您选择的操作是「查询名片」")
            cards_tools.search_card()

        elif number == 0:

            print("程序退出!谢谢使用!")
            break

        else:
            print("输入错误,请重新输入!")
Пример #2
0
# #!+ python解释器的全路径可以在linux中将文件变为可执行文件(需要执行的权限)
#! /usr/local/python3

import cards_tools

# 无限循环,由用户决定什么时候退出循环!
while True:

    # 显示功能菜单
    cards_tools.show_menu()

    action_str = input("请选择希望执行的操作:")
    print("您选择的操作是【%s】" % action_str)

    # 1,2,3 针对名片的操作
    if action_str in ["1", "2", "3"]:

        # 新增名片
        if action_str == "1":
            cards_tools.new_card()
        # 显示全部
        elif action_str == "2":
            cards_tools.show_all()
        # 查询名片
        else:
            cards_tools.search_card()

    # 0 退出系统
    elif action_str == "0":

        print("欢迎再次使用【名片管理系统】")
Пример #3
0
import cards_tools
while True:
    action_str=cards_tools.show_menu()  #显示菜单
    if action_str in ["0","1","2","3"]:
        if action_str =="1":
            cards_tools.new_card()
        elif action_str =="2":
            cards_tools.show_all()
        elif action_str =="3":
            cards_tools.sch_card()
        elif action_str =="0":
            print("正在退出...欢迎下次使用本系统")
            break
    else: print("您的输入有误,请重新输入")
Пример #4
0
import cards_tools
flage = True
while 1:
    cards_tools.show_menu()  #引入欢迎界面模块
    action = input("请选择输入功能:")
    print("您选择的操作是:%s" % action)
    if action in ["1", "2", "3", "4"]:  # in针对列表,可以避免输入的不是数字
        if action == "1":
            cards_tools.new_card()
        elif action == "2":
            cards_tools.show_all()
        elif action == "3":
            cards_tools.search_card()
        elif action == "4":
            cards_tools.input_cards_info("李", "false")
    elif action == "0":
        flage = False
    else:
        print("input false ,please ")
Пример #5
0
import cards_tools as ct
while True:
    # TODO 显示菜单
    ct.show_menu()
    # num = int(input("Please input your choice:"))
    # 在需要用户输入内容时,尽量不要进行 int 转换,若用户输入的不是数字时,程序会报错
    num = input("Please input your choice:")
    if num in ['1', '2', '3']:
        #新增名片
        if num == '1':
            ct.new_card()
        #显示全部名片
        elif num == '2':
            ct.show_all()
        #查询名片
        elif num == '3':
            ct.search_cards()
        pass
    #在程序开发时不希望立即编写分支内部代码
    #可以是 pass 关键字,表示一个占位符,能够保证代码的结构正确!
    #程序运行时,pass 关键字不会执行任何操作!
    elif num == '0':
        print("欢迎再次使用!")
        break
    else:
        print("your input is error,please input again!")