Included in at least one reviewed higher-education syllabus.
2.5 Files, paths and data I/O
You can read and write every format you will meet this year.
Before:00. Orientation & SetupUnlocks:03. Data Handling & Analysis04. Classical AI — Agents, Search & Knowledge Representation
Every project starts by reading files and ends by writing them, and pathlib plus context managers make that safe and portable across machines. CSV, JSON and YAML cover nearly every config and dataset this year will bring. It sits here because input and output precede everything interesting. The recurring pain it prevents is encoding: files that work locally and explode elsewhere are an encoding declaration away from fixed.
Work through these
pathlib over os.path
The modern object-oriented way of handling file paths, which is clearer and less error-prone than string manipulation. Adopting it early avoids relearning later.
Context managers and the with statement
The construct that guarantees a file is closed even if something fails partway. It is the standard idiom and it applies well beyond files.
CSV, JSON, JSONL, YAML
The four data formats you will meet constantly, each with a standard library or common tool for reading it. Knowing which format suits which situation is part of the item.
Encoding errors and how to survive them
Files arrive in unexpected encodings and reading them naively fails, sometimes silently. The strategies for detecting and handling that are practical knowledge rather than theory.
Sign in to keep your progress.
Free resources
We haven't checked most of these for screen reader use yet.
Links last checked 29 Aug 2026.
Stuck here?
Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.
Checking your session…
Topics shown in module order.