Building a Persistent Smart Contact Book CLI App Using Pure Python

작성자

카테고리:

← 피드로
DEV Community · Nivedya AV · 2026-09-20 개발(SW)

Nivedya AV

Hello DEV Community!

As a 2nd-year BCA student aspiring to become a Web / Developer Advocate, I believe that mastering data structures, error handling, and file persistence is crucial. Today, I am excited to share my 4th python project: a Smart Contact Book CLI Application built completely from scratch!

Unlike basic scripts that lose data when closed, this tool stores all data locally and validates inputs efficiently to mimic real-world system behavior.

Key Features

  • Local Data Persistence (JSON): Stores contacts securely in a contacts.json file so data is never lost.
  • Robust Input Validation: Ensures phone numbers are exactly 10 digits and validates email structures (@' and.`).
  • Full CRUD Operations: Allows to Add, View, Search, and Delete contacts through a continuous interactive menu.
  • Crash-Proof Design: Uses try-except blocks to handle empty inputs or missing files gracefully.

What I Learned From This Project

Building this application helped me master several critical backend concepts:

  • File I/O & JSON Parsing: Reading and writing structured dictionary data using Python’s inbuilt json module.
  • Defensive Programming: Anticipating bad user inputs and catching errors before they cause system crashes.
  • Git Workflow Management: Staging, committing, and managing repository files efficiently within VS code.

Source Code & Repository

I have hosted the complete codebase along with my updated learning journey on GitHub. check it out here:

Link to my GitHub Repository

I Would Iove to get your feedback on how I can optimize this logic further! Should I add an Edit/Update” feature next, or migrate the data handling into a SQLite database? Let me know in the comments!

원문에서 계속 ↗