You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.5 KiB

stu_list=[]
def menu():
print("1.添加学生")
print("2.删除学生")
print("3.修改学生信息")
print("4.查询学生信息")
print("5.显示学生信息")
print("6.保存学生信息")
print("7.退出系统")
def add_student():#添加学生信息
name = input('请输入学生姓名:')
# -----------
for i in stu_list:
if i['name'] == name:
print('学生信息已存在')
return
gender= input("请输入学生性别:")
phone=input("请输入学生电话:")#加入信息
stu_dict= { 'name': name, 'gender': gender,'phone':phone}
stu_list.append(stu_dict)
print()
def remove_student():#删除学生信息
name=input('请输入要删除学生姓名:')
for i in stu_list:
if i['name'] == name:
stu_list.remove(i)
print('学生信息删除成功')
return
else:
print('该学生信息不存在,无法删除')
while True:
num=eval(input("请输入序号:"))
if num==1:
add_student()
elif num==2:
remove_student()
# elif num==3:
# modify_student()
# elif num==4:
# search_student()
# elif num==5:
# show_student()
# elif num=6:
# save_student()
# elif num==7:
# print('退出系统,欢迎下次使用')
# save()
# break
else:
print("输入有误,请再次输入")
continue
input('======回车键继续操作======')