From scripts to reliable tools / CORE PATH
Files, CSV, JSON & paths
Read and write data with explicit formats and encodings.
Treat landing files as immutable inputs and publish new outputs.
Understand the idea
Read and write data with explicit formats and encodings. Treat landing files as immutable inputs and publish new outputs.
Work through the practice with a tiny fixture, predict the result before running it, and record one boundary case. Use the exit check as evidence before moving on.
What to learn
- Use pathlib and with to manage files.
- Distinguish CSV strings from typed values.
- Record UTF-8, delimiters, field names and date formats.
Practice on your own data
Run the supplied pipeline on data/fixtures/orders.csv and inspect rejects.csv.
Practice this lesson in the Python lab →
EXIT CHECK
Missing columns fail clearly; Arabic text round-trips; original input is untouched.
Prerequisites
Modules, typing & data classes
Sources and further reading
- Python language tutorial ↗Official documentation
- Harvard CS50P · lectures & problem sets ↗User-selected HarvardX CS50P course
Track progress on this topic → · Markdown source ↗
Next lesson: Tests that catch a broken contract →