python开发信息管理系统
python解释器版本:python3.7.0
开发环境:win7(64位)
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71# _*_ coding:utf-8 _*_ # 开发时间:2019/4/18 19:59 # 文件名称:tool.py # 开发工具:PyCharm card_list = [] #定义信息列表 def shown_menu(): print("*"*80) print("1、新建名片n2、显示全部n3、查询名片nn4、退出系统") print("*"*80) def new_card(): #新增名片 print("-"*80) print("新增信息") #1、提示输入信息 name_str = input("请输入姓名:") phone_str = input("请输入电话号码:") qq_str = input("请输入邮箱:") #2、使用输入建立信息字典 card_dict = {"name": name_str, "phone": phone_str, "email": qq_str, } #3、将信息字典添加到列表之中 card_list.append(card_dict) print(card_list) #4、提示添加成功 print("%s信息添加成功" %name_str) def shown_all(): """ 显示全部 :return: """ print("-" * 80) print("显示所有") if len(card_list) == 0: print("无记录") return #1、打印表头 for name in ["姓名","电话","邮箱"]: print(name.ljust(20),end="t") print("") print("=" * 80) for card_dict in card_list: print("%st%st%st" %((card_dict["name"]).ljust(20), (card_dict["phone"]).ljust(20), (card_dict["email"]).ljust(20))) def search_card(): """ 查找名片 :return: """ print("-" * 80) print("查找信息") #接收输入 find_name = input("请输入姓名:") # 遍历card_list,查询信息 for card_dict in card_list: if card_dict["name"] == find_name: for name in ["姓名", "电话", "邮箱"]: print(name.ljust(20), end="t") print("") print("%st%st%st" % ((card_dict["name"]).ljust(20), (card_dict["phone"]).ljust(20), (card_dict["email"]).ljust(20))) break else: print("non")
以上是定义的功能模块
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17import tool while 1: tool.shown_menu() action = int(input("请输入功能选择:")) print("选择的操作是:%d" %action) if action == 1: tool.new_card() elif action == 2: tool.shown_all() elif action == 3: tool.search_card() elif action == 0: print("退出系统n") break else: print("输入错误,请重新输入n")
以上是主程序单元
本人是python的初学者,发文记录学习日记,代码经供参考,不用于其他用途
最后
以上就是虚心西装最近收集整理的关于python开发信息管理系统的全部内容,更多相关python开发信息管理系统内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复