Skip to content

04-15: Personal Diary App

Python: Fundamentals

View the live site — ijk37.com

Project 15

Home  |  All Projects  |  Notes  |  Exercises  |  Quiz Hub

Saves diary entries to a diary.txt file on disk. Each entry is timestamped and stored with a structured header. Supports listing, reading by number, and keyword searching — all backed by real file I/O.

Topics covered: open() in append/read mode · pathlib.Path · datetime.now().strftime() · text file parsing · str.splitlines() · str.split(separator) · functions · while-loop menu

Difficulty: ⭐⭐ Beginner–Intermediate


How to Run

python main.py

A diary.txt file is created in the same directory automatically.


File Format

============================================================
DATE: 2025-06-09 14:35
TITLE: My First Entry
----
Today I started learning Python file I/O.
It was really interesting!
============================================================

Key Concepts Practised

Concept Where used
open(file, "a") Appending new entries
open(file, "r") Reading all entries
pathlib.Path.exists() Check file before reading
content.split(SEPARATOR) Splitting entries
datetime.now().strftime() Timestamp generation
str.splitlines() Parsing entry header lines