基本架构
#----------------------python学生信息管理统---------------------#
需求设计:
1.添加学生的成绩信息
2.学生信息保存在文件夹中
3.修改及删除学生信息
4.查询学生的信息
5.根据学生的成绩进行排名
6.计算总成绩进行排列
基本系统设定
模块一:
学生成绩维护部分
1.录入学生信息
2.删除学生信息
3.修改学生信息
模块二:
查询/统计模块
1.按姓名查找
2.按学号查找
3查询显示所有学生的信息
4.统计学生总人数
模块三:
排序:
1。每门程序排列
2.综合成绩排列
内置模块 :re 、os

需要导入函数

import os
import re

界面模块

def menu():
print( " |-----------------------------学生信息管理系统-----------------------------|\n",
“| |\n”,
“| 1.学生信息录入 |\n”,
“| 2.学生信息修改 |\n”,
“| 3.学生信息查询 |\n”,
“| 4.学生信息删除 |\n”,
“| 5.排序 |\n”,
“| 6.统计总人数 |\n”,
“| 7. 显示所有学生的信息 |\n”,
“| 0.系统退出 |\n”,
“|--------------------------------------------------------------------------|\n”
" |-----------------------------说明:通过数字或上下方向键选择菜单-----------|")`

主程序部分 `

主程序部分 `

在这里插入代码片def main():exit = True    #标记是否退出while(exit):menu()   #显示菜单option = input("请选择:") #选择序号进行option_str = re.sub("\D","",option)#提取数字if option_str in ['0','1','2','3','4','5','6','7',]:option_int = int(option_str)if option_int == 0:print("你已退出该系统")exit = Falseelif option_int == 1:insert()elif option_int == 2:modify()elif option_int == 3:seach()elif option_int == 4:deleter()'''elif option_int == 5:sort()'''''elif option_int == 6:total()elif option_int == 7:show()`## 学生信息加入def insert():studentlist = []mark = Truewhile mark:id = input("请输入你的id(如1001):")if not id:breakname = input("请输入你的名字:")if not name:breakage = input("请输入你的年龄:")if not age:breaktry:chinese_score = int(input("请输入你的语文成绩"))math_score = int(input("请输入你的数学成绩"))english_score = int(input("请输入你的英语成绩"))except:print("输入无效不是整型")continuestudent_dict = {"id":id,"name":name,"age":age,"chinese_score":chinese_score,"math_score":math_score,"english_score":english_score}studentlist.append(student_dict)inputmark = input("是否继续添加(Y/n):")if inputmark == "Y":mark = Trueif inputmark == "n":mark = Falsesave(studentlist)print("学生信息录入完毕")## 修改学生信息 ```
def modify():show()if os.path.exists("student_systeminfo.txt"):with open("student_systeminfo.txt",'r') as rfile:student_old = rfile.readlines()else:returnstudentid = input("请输入你要修改的学生id:")with open("student_systeminfo.txt","w") as wfile:for student in student_old:d = dict(eval(student))if d["id"] == studentid:print("已找到该名学生,是否进行修改")while True:try:d["name"] = input("请输入姓名")d["chinese_score"] = int(input("请输入你的语文成绩"))d["math_score"] = int(input("请输入你的数学成绩"))d["english_score"] = int(input("请输入你的英语成绩"))except:print("您输入的有误,请重新输入")else:breakstudent = str(d)wfile.write(student+"\n")print("修改成功")else:wfile.write(student)mark = input("是否还需要修改其他学生的信息")if mark == "y":modify()## 学生信息查找def seach():mark = Truestudent_query = []while mark:id = ""name = ""if os.path.exists("student_systeminfo.txt"):mode = input("按id查找输入1,按姓名查找输入2:")if mode == "1":id = input("请输入学生的id:")elif mode == "2":name = input("请输入学生姓名:")else:print("输入错误")seach()with open("student_systeminfo.txt","r") as file:student = file.readline()for list in student:d = dict(eval(list))if id is not "":if d [id] == id:student_query.append(d)elif name is not "":if d[name] == name:student_query.append(d)show_student(student_query)student_query.clear()inputMark = input("是否继续查询(x/y)")if inputMark == "y":mark = Trueelse:mark = Falseelse:print("暂时未保存信息。。。")return## 学生包含信息显示
def show_student(studentlist):if not studentlist:print("无信息")returnformat_title = "{:^6}{:^12}\t{:^8}\t{:^10}\t{:^10}\t{:^10}"print(format_title.format("id","名字","chinese_score","语文成绩","math_score","数学成绩","english_score","英语成绩"))format_data = "{:^6}{:^12}\t{:^12}\t{:^12}\t{:^12}\t{:^12}"for info in studentlist:print(format_data.format(info.get("id")))info.get("name"),str(info.get("chinese_score")),str(info.get("math_score")),str(info.get("english_score"))str(info.get("chinese_score")+ info.get("math_score")+info.get("english_score").center(12))def show():student_new = []if os.path.exists("student_systeminfo.txt"):with open("student_systeminfo.txt","r") as rfile:student_old = rfile.readline()for list in  student_old:student_new.append(eval(list))if student_new:show_student(student_new)else:print("暂未保存数据信息")## 学生信息删除```def deleter():mark = Truewhile mark:student_id = input("请输入你要删除的学生id去的")if student_id is not '':if os.path.exists("student_systeminfo.txt"):#判断文件是否存在with open("student_systeminfo.txt","r") as rfile:student_old = rfile.readline()else:student_old = []ifdel = Falseif student_old:with open("student_systeminfo.txt","w") as wfile:d = {}for list in student_old:d = dict(eval(list))if d['id'] != student_id:wfile.write(str(d)+'\d')else:ifdel = Trueif ifdel:print("id为%s的学生已被删除"%student_id)else:print("没有找到id为%s的信息"%student_id)else:print("无信息。。。")breakshow()inputMark = input("是否要继续删除?【y/n】:")if inputMark == "y":mark = Trueelse:mark = False## 学生信息排序模块
def sort()## 成绩总和计算
def total():if os.path.exists("student_systeminfo.txt"):with open("student_systeminfo.txt","r") as  rfile:student_old = rfile.readline()if student_old:print("一共有%d个学生"%len(student_old))else:print("没有录入学生信息")else:print("暂未保存数据信息")## 学生信息运行模块
if __name__=="__main__":main()## `源码`
#-*- codeing = utf-8 -*-
#@Time:2021/3/6 22:53
#@Author:publishment ghost
#@File:studentssystem.py
#@Software:PyCharm
#内置模块
import re #re模块为正则表达式
import os #os模块为提供多接口模式
#菜单模块
def menu():print( " |-----------------------------学生信息管理系统-----------------------------|\n","|                                                                          |\n","|                            1.学生信息录入                                |\n","|                            2.学生信息修改                                |\n","|                            3.学生信息查询                                |\n","|                            4.学生信息删除                                |\n","|                            5.排序                                        |\n","|                            6.统计总人数                                  |\n","|                            7. 显示所有学生的信息                         |\n","|                            0.系统退出                                    |\n","|--------------------------------------------------------------------------|\n"" |-----------------------------说明:通过数字或上下方向键选择菜单-----------|")
#主程序部分
def main():exit = True    #标记是否退出while(exit):menu()   #显示菜单option = input("请选择:") #选择序号进行option_str = re.sub("\D","",option)#提取数字if option_str in ['0','1','2','3','4','5','6','7',]:option_int = int(option_str)if option_int == 0:print("你已退出该系统")exit = Falseelif option_int == 1:insert()elif option_int == 2:modify()elif option_int == 3:seach()elif option_int == 4:deleter()'''elif option_int == 5:sort()'''''elif option_int == 6:total()elif option_int == 7:show()
def save(student):try:student_txt = open("student_systeminfo.txt","a")except Exception as e:student_txt = open("student_systeminfo.txt","w")for info in student:student_txt.write(str(info)+"\n")student_txt.close()
def insert():studentlist = []mark = Truewhile mark:id = input("请输入你的id(如1001):")if not id:breakname = input("请输入你的名字:")if not name:breakage = input("请输入你的年龄:")if not age:breaktry:chinese_score = int(input("请输入你的语文成绩"))math_score = int(input("请输入你的数学成绩"))english_score = int(input("请输入你的英语成绩"))except:print("输入无效不是整型")continuestudent_dict = {"id":id,"name":name,"age":age,"chinese_score":chinese_score,"math_score":math_score,"english_score":english_score}studentlist.append(student_dict)inputmark = input("是否继续添加(Y/n):")if inputmark == "Y":mark = Trueif inputmark == "n":mark = Falsesave(studentlist)print("学生信息录入完毕")def modify():show()if os.path.exists("student_systeminfo.txt"):with open("student_systeminfo.txt",'r') as rfile:student_old = rfile.readlines()else:returnstudentid = input("请输入你要修改的学生id:")with open("student_systeminfo.txt","w") as wfile:for student in student_old:d = dict(eval(student))if d["id"] == studentid:print("已找到该名学生,是否进行修改")while True:try:d["name"] = input("请输入姓名")d["chinese_score"] = int(input("请输入你的语文成绩"))d["math_score"] = int(input("请输入你的数学成绩"))d["english_score"] = int(input("请输入你的英语成绩"))except:print("您输入的有误,请重新输入")else:breakstudent = str(d)wfile.write(student+"\n")print("修改成功")else:wfile.write(student)mark = input("是否还需要修改其他学生的信息")if mark == "y":modify()
def seach():mark = Truestudent_query = []while mark:id = ""name = ""if os.path.exists("student_systeminfo.txt"):mode = input("按id查找输入1,按姓名查找输入2:")if mode == "1":id = input("请输入学生的id:")elif mode == "2":name = input("请输入学生姓名:")else:print("输入错误")seach()with open("student_systeminfo.txt","r") as file:student = file.readline()for list in student:d = dict(eval(list))if id is not "":if d [id] == id:student_query.append(d)elif name is not "":if d[name] == name:student_query.append(d)show_student(student_query)student_query.clear()inputMark = input("是否继续查询(x/y)")if inputMark == "y":mark = Trueelse:mark = Falseelse:print("暂时未保存信息。。。")return
def show_student(studentlist):if not studentlist:print("无信息")returnformat_title = "{:^6}{:^12}\t{:^8}\t{:^10}\t{:^10}\t{:^10}"print(format_title.format("id","名字","chinese_score","语文成绩","math_score","数学成绩","english_score","英语成绩"))format_data = "{:^6}{:^12}\t{:^12}\t{:^12}\t{:^12}\t{:^12}"for info in studentlist:print(format_data.format(info.get("id")))info.get("name"),str(info.get("chinese_score")),str(info.get("math_score")),str(info.get("english_score"))str(info.get("chinese_score")+ info.get("math_score")+info.get("english_score").center(12))
def deleter():mark = Truewhile mark:student_id = input("请输入你要删除的学生id去的")if student_id is not '':if os.path.exists("student_systeminfo.txt"):#判断文件是否存在with open("student_systeminfo.txt","r") as rfile:student_old = rfile.readline()else:student_old = []ifdel = Falseif student_old:with open("student_systeminfo.txt","w") as wfile:d = {}for list in student_old:d = dict(eval(list))if d['id'] != student_id:wfile.write(str(d)+'\d')else:ifdel = Trueif ifdel:print("id为%s的学生已被删除"%student_id)else:print("没有找到id为%s的信息"%student_id)else:print("无信息。。。")breakshow()inputMark = input("是否要继续删除?【y/n】:")if inputMark == "y":mark = Trueelse:mark = False
#def sort():def total():if os.path.exists("student_systeminfo.txt"):with open("student_systeminfo.txt","r") as  rfile:student_old = rfile.readline()if student_old:print("一共有%d个学生"%len(student_old))else:print("没有录入学生信息")else:print("暂未保存数据信息")def show():student_new = []if os.path.exists("student_systeminfo.txt"):with open("student_systeminfo.txt","r") as rfile:student_old = rfile.readline()for list in  student_old:student_new.append(eval(list))if student_new:show_student(student_new)else:print("暂未保存数据信息")
if __name__=="__main__":main()运行程序![在这里插入图片描述](https://img-blog.csdnimg.cn/20210317154701276.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3NqanNrc2hz,size_16,color_FFFFFF,t_70)

python学生教务管理系统相关推荐

  1. (附源码)python学生成绩管理系统 毕业设计 061011

    python学生成绩管理系统的设计与实现 摘 要 随着互联网趋势的到来,各行各业都在考虑利用互联网将自己推广出去,最好方式就是建立自己的互联网系统,并对其进行维护和管理.在现实运用中,应用软件的工作规 ...

  2. python 学生信息管理系统(二)

    完整的代码放在<python 学生信息管理系统(一)>里,这里记录我学习中遇到的新问题. 附:编写好的部分学生信息文件 stu.txt如下: {'id': '0101', 'name': ...

  3. (附源码)Python学生公寓管理系统的设计与实现 毕业设计181047

    Python学生公寓管理系统的设计与实现 摘 要 科技进步的飞速发展引起人们日常生活的巨大变化,电子信息技术的飞速发展使得电子信息技术的各个领域的应用水平得到普及和应用.信息时代的到来已成为不可阻挡的 ...

  4. Python学生公寓管理系统的设计与实现 毕业设计-附源码181047

    Python学生公寓管理系统的设计与实现 摘 要 科技进步的飞速发展引起人们日常生活的巨大变化,电子信息技术的飞速发展使得电子信息技术的各个领域的应用水平得到普及和应用.信息时代的到来已成为不可阻挡的 ...

  5. python综合管理系统代码_《python学生信息管理系统》[52KB]PDF代码版下载-码农之家...

    <python学生信息管理系统>是一本python相关的电子书资源,介绍了关于python.学生管理系统方面的内容,格式为PDF,资源大小52 KB,由26622451 提供,目前在&qu ...

  6. 【Go】学生教务管理系统【无界面 / 单机版】(一)

    [Go]学生教务管理系统(无界面 / 单机版)(一) Ⅰ. 程序说明 一.博客日期 二.引言 Ⅱ. 版权声明 Ⅲ. 开发环境 一.开发配置 二.开发工具 Ⅳ. 效果演示 一.工程结构 (一)目录结构 ...

  7. python学生成绩管理系统 毕业设计-附源码061011

    摘 要 随着互联网趋势的到来,各行各业都在考虑利用互联网将自己推广出去,最好方式就是建立自己的互联网系统,并对其进行维护和管理.在现实运用中,应用软件的工作规则和开发步骤,采用python技术建设学生 ...

  8. python高校教务管理系统

    高校教务管理系统主要包括二大功能模块,即管理员功能模块和用户功能模块. (1)管理员模块:注册管理.教师管理.课程管理.选课安排.学生管理等功能 (2)用户:首页.个人资料.我的课程.个人成绩.校内信 ...

  9. [Student.Achieve] 学生教务管理系统开源

    (源自:https://neters.club) 一觉醒来Github改版了,我个人还是挺喜欢的????. 还有两个月就是老张做开源两周年了,时间真快,也慢慢的贡献了很多的开源作品,上边的是主要的七个 ...

  10. python学生信息管理系统

    目录 main函数 菜单界面 录入学生信息 保存信息 查找学生信息 删除学生信息 修改学生信息 排序 统计学生总人数 显示所有学生信息 显示信息 import re # 导入正则表达式模块 impor ...

最新文章

  1. 比特币的闪电网络正在创建自己的黑客阵营
  2. SQL Server中查看SQL句子执行所用的时间
  3. Java_apply_in_automatic_system
  4. 【收藏】生产订单业务流程
  5. 《剑指offer》-- 序列化二叉树、二叉搜索树的第k个节点、数据流中的中位数、滑动窗口的最大值
  6. android 整数与ip地址的转换
  7. 字符串常量池StringTable 你真的了解么
  8. 2021双十一电商行业研究报告:重塑消费决策链条,内容种草成电商新标配
  9. GitHub 标星8.6K:将任何设备转换为电脑的辅助屏幕
  10. mysql1000w数据怎么加索引_给mysql一百万条数据的表添加索引
  11. day08—css布局解决方案之多列布局
  12. QT5.11安装教程
  13. 点击换图 秀米的svg_能换色的.svg图片怎么用?看这篇就够了!
  14. java汉字字符串转拼音
  15. 互联网定律及效应汇编
  16. MySQL练习sql脚本(某校学生管理系统版本)
  17. MLY -- 6.Your dev and test sets should come from the same distribution
  18. 2016年东莞市程序设计竞赛镇区选拔赛上机试题小学组:seat(找座位)
  19. excel行列互换_EXCEL图表中的堆积柱形图如何行列互换
  20. 深度学习:图像的卷积原理和本质(详解)。

热门文章

  1. 如何准备全国大学生电子设计大赛控制题?
  2. Java-Aspose实现上传Excel、Word转换为PDF并进行下载
  3. 使用VBA通过Excel生产Word报告
  4. HikariCP配置手册
  5. Stolz定理及其在求极限上的应用
  6. 用户金字塔模型的应用:知乎案例分析
  7. 电池充放电设备招投标解决方案
  8. 有没有一个好用的番茄钟时间管理工具?
  9. MySQL——MySQL 图形化管理工具的介绍
  10. mysql jemalloc_安装 jemalloc for mysql