import cards_tools while True: cards_tools.show_menu() action = input("请您输入操作编号") print("您选择的操作是【%s】" % action) if action in ["1", "2", "3"]: if action == "1": cards_tools.new_a_card() if action == "2": cards_tools.show_all_cards() if action == "3": cards_tools.search_card() elif action == "4": print("感谢您的使用 再见") break else: # 提示输入错误 print("您输入的选项有误 请重新输入")