Fundamentals 10 min read

Python Student Information Management System Tutorial with Complete Source Code

This article presents a step‑by‑step tutorial for building a console‑based student information management system in Python, covering system design, functional requirements, detailed function implementations for adding, deleting, modifying, searching, and displaying records, and provides the full source code with execution screenshots.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Python Student Information Management System Tutorial with Complete Source Code

The tutorial introduces a simple student information management system implemented in Python, outlining six core functionalities: add, delete, modify, search, display all student records, and exit the program.

System Overview

The system repeatedly shows a menu, accepts a numeric choice from the user, and calls the corresponding function until the user selects the exit option.

Key Functions

def info_print(): print('--------请选择功能-----') print('1、添加学生') print('2、删除学生') print('3、修改学生') print('4、查询学生') print('5、显示所有学生') print('6、退出系统') print('-' * 20)

def add_info(): """添加学生函数""" new_id = input('输入学号:') new_name = input('输入姓名:') new_tel = input('输入手机号:') global info for i in info: if new_name == i['name']: print('此用户已经存在,请勿重复添加') return info_dict = {'id': new_id, 'name': new_name, 'tel': new_tel} info.append(info_dict) print(info)

def del_info(): """删除学生""" del_name = input('请输入要删除的学生的姓名:') global info for i in info: if del_name == i['name']: info.remove(i) break else: print('该学生不存在!') print(info)

def modify_info(): """修改函数""" modify_name = input('请输入要修改的学生的姓名:') global info for i in info: if modify_name == i['name']: i['tel'] = input('请输入新的手机号:') break else: print('该学生不存在') print(info)

def search_info(): """查询学生信息""" search_name = input('请输入要查找的学生姓名:') global info for i in info: if search_name == i['name']: print('找到该学生的信息如下:') print(f"该学生的学号是{i['id']},姓名是{i['name']},手机号是{i['tel']}") break else: print('该学生不存在!')

def print_all(): """显示所有学生信息""" print('学号\t姓名\t手机号') for i in info: print(f"{i['id']}\t{i['name']}\t{i['tel']}")

The main loop ties everything together:

while True: info_print() user_num = eval(input('请输入功能序号:')) if user_num == 1: add_info() elif user_num == 2: del_info() elif user_num == 3: modify_info() elif user_num == 4: search_info() elif user_num == 5: print_all() elif user_num == 6: exit_flag = input('确定要退出吗?yes/no?') if exit_flag == 'yes': break else: print('输入的功能序号有误!')

Execution screenshots demonstrate adding, deleting, modifying, searching, displaying all records, and exiting the system. The article concludes with a QR code and links for further Python learning resources.

CLIPythondata-structuresTutorialProgramming Basicsstudent-management
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.