Skip to content

Commit c34f38c

Browse files
committed
feat: cards main
1 parent 5843e21 commit c34f38c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

codes/card_manage/cards_main.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# 无限循环,由用户决定何时结束
2+
import cards_tools
3+
while True:
4+
5+
# 显示功能菜单
6+
cards_tools.show_menu()
7+
8+
action_str = input("请选择希望执行的操作:")
9+
print("您选择的操作是 【%s】" % action_str)
10+
11+
# 1,2,3 针对名片的操作
12+
if action_str in ["1", "2", "3"]:
13+
# 如果在程序开发时,不希望立刻编写分支内部的代码
14+
# 可以使用 pass 关键字,表示一个占位符,能够保证程序结构正确!
15+
# 程序运行时,pass 关键字不会执行任何的操作
16+
17+
# 新增名片
18+
if action_str == "1":
19+
cards_tools.new_card()
20+
# 显示全部
21+
elif action_str == "2":
22+
cards_tools.show_all()
23+
# 查询名片
24+
else:
25+
cards_tools.search_card()
26+
# 0 退出系统
27+
elif action_str == "0":
28+
print("-" * 50)
29+
print("退出系统")
30+
print("欢迎再次使用【名片管理系统】")
31+
# pass
32+
break
33+
# 其他内容输入错误,提示用户
34+
else:
35+
print("您输入的不正确,请重新选择")

0 commit comments

Comments
 (0)