python实现学生通讯录管理系统
作者:大碗吃不下 时间:2023-05-06 22:00:05
本文实例为大家分享了python实现学生通讯录管理系统的具体代码,供大家参考,具体内容如下
功能模块分析:
1.首页(菜单功能)
2.添加学生
3.删除学生
4.修改学生
5.统计通讯录联系人人数
6.获取所有学生通讯信息
代码如下:
def main():
while True:
menu()
number = int(input("请输入需要实现的操作的序号:"))
if number==1:
insert() #添加学生
if number==2:
delete() #删除学生
if number==3:
modify() #修改学生
if number==4:
count() #统计通讯录联系人人数
if number==5:
disply() #获取所有学生通讯信息
if number==0:
x=input("输入yes退出系统,输入其他任意字符不退出:")
if x == "yes":
break
studentlist=[]
def menu():
Menu = """
====================学生通讯录管理系统-V1.0====================
1.添加学生
2.删除学生
3.修改学生
4.统计通讯录联系人人数
5.获取所有学生通讯信息
0.退出系统
=====================================================
"""
print(Menu)
def insert():
while True:
studentdict={}
studentdict["序号"]=input("请输入需添加学生的序号:")
studentdict["姓名"]=input("请输入需添加学生的姓名:")
studentdict["电话"]=input("请输入需添加学生的电话:")
studentlist.append(studentdict)
x = input("输入no结束添加学生,输入其他任意字符将继续:")
if x=="no":
break
def delete():
while True:
i=input("请输入需删除的学生的序号:")
for index,item in enumerate(studentlist):
if item["序号"]==i:
del studentlist[index]
x = input("输入no结束删除学生,输入其他任意字符将继续:")
if x == "no":
break
def modify():
while True:
i = input("请输入需修改的学生的序号:")
for item in studentlist:
if item["序号"]==i:
item["姓名"]=input("请输入修改后的学生的姓名:")
item["电话"]=input("请输入修改后的学生的电话:")
x = input("输入no结束修改学生,输入其他任意字符将继续:")
if x == "no":
break
def count():
a=len(studentlist)
print("通讯录共有",a,"位联系人")
def disply():
print('---------------------------')
for studentdict_1 in studentlist:
for key,value in studentdict_1.items():
print(key,":",value)
print('---------------------------')
main()
来源:https://blog.csdn.net/My_daily_life/article/details/109221501
标签:python,通讯录,管理系统
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
MySQL5.6解压版服务无法启动之系统错误1067问题
2024-01-14 18:20:46
![](https://img.aspxhome.com/file/2023/8/108918_0s.png)
從無到有實現一個xml數據庫登錄驗証
2008-09-05 17:12:00
利用sort()和Math.random()实现元素的随机排列
2010-10-19 12:42:00
Python算法应用实战之队列详解
2022-08-21 11:49:33
![](https://img.aspxhome.com/file/2023/4/80694_0s.png)
Python 根据数据模板创建shapefile的实现
2023-07-27 00:10:32
opencv python在视屏上截图功能的实现
2021-04-14 04:00:30
![](https://img.aspxhome.com/file/2023/5/63575_0s.jpg)
Sublime Text4 配置 Python3 环境、代码提示、编译报错的解决方案
2021-09-24 12:00:03
![](https://img.aspxhome.com/file/2023/4/72074_0s.png)
深入理解Python中的super()方法
2022-11-07 05:10:45
几种修复ACCESS数据库的实用方法
2008-11-20 17:37:00
详解在Python程序中使用Cookie的教程
2021-10-25 17:58:43
Python中List.count()方法的使用教程
2023-08-12 11:56:15
python 实现多进程日志轮转ConcurrentLogHandler
2021-03-01 02:03:42
增删改查sql语法基础教程
2024-01-16 23:42:18
Python的动态重新封装的教程
2023-08-23 15:26:39
在 Windows 10 上安装 解压缩版 MySql(推荐)
2024-01-21 18:18:24
![](https://img.aspxhome.com/file/2023/7/118467_0s.png)
原生js实现放大镜组件
2024-05-11 09:06:05
![](https://img.aspxhome.com/file/2023/7/127187_0s.jpg)
Python中二维列表如何获取子区域元素的组成
2021-02-16 02:41:01
![](https://img.aspxhome.com/file/2023/8/95488_0s.png)
python开发的自动化运维工具ansible详解
2022-12-11 08:40:00
![](https://img.aspxhome.com/file/2023/8/64298_0s.jpg)
前后端分离和跨域问题的详细解决方案(CORS的原理)
2023-05-30 01:19:26
![](https://img.aspxhome.com/file/2023/7/55307_0s.png)
页面只能打开一次Cooike如何实现
2024-04-22 22:39:32