A beginner-friendly Python CLI application for managing student records using JSON file storage.
- View all students
- Add new students
- Search students by name
- Delete students
- Persistent data storage using JSON
- Handles missing JSON files
- Input validation using
try/except - Case-insensitive student search
- Python functions
- Lists
- Dictionaries
- Loops
- Conditional statements
- Function arguments
- File handling
- JSON
json.load()json.dump()try/exceptFileNotFoundErrorValueError- List
append() - List
remove() - Dictionary
.get() - String
.lower()
The application loads student data from students.json when it starts.
When a student is added or deleted, the updated student list is saved back to the JSON file.
students.json
↓
json.load()
↓
Python list
↓
Add / View / Search / Delete
↓
json.dump()
↓
students.json
1. View Students
2. Add Student
3. Search Student
4. Delete Student
5. Exit
Each student is stored as a dictionary inside a list.
Example:
students = [
{
"name": "Muhammad Ahsan",
"age": 21,
"university": "COMSATS University Islamabad",
"department": "Computer Engineering",
"semester": 5,
"favorite_language": "Python",
"dream_company": "Phoenix AI"
}
]
The complete list is stored permanently in a JSON file.
The application uses try/except to handle invalid numerical input.
If the user enters text instead of a number for age or semester, the program does not crash. It asks the user to enter a valid number.
The application also handles a missing students.json file by starting with an empty student list.
- Python 3.x
- No external libraries required
python main.py
The program will use students.json for persistent student data.
This project introduces the basic CRUD concept:
- Create → Add Student
- Read → View and Search Students
- Update → Not implemented in this version
- Delete → Delete Student
Python Fundamentals
↓
Lists & Dictionaries
↓
Functions
↓
File Handling
↓
JSON
↓
Persistent Data
↓
CRUD Operations
↓
Error Handling
The goal of this project was to learn how Python applications can manage structured data and store that data permanently using JSON.
This project moves beyond simple terminal programs and introduces the foundations of real data-driven applications.
Muhammad Ahsan
Computer Engineering Student
COMSATS University Islamabad, Lahore Campus