Lesson 8 of 48
Python: files and automation
Make the machine do something tedious that you actually have to do.
The moment a script saves you real time, programming stops being homework. It is also the first time your code meets data you did not invent — messy, inconsistent, and the only kind that exists outside a textbook.
Do this
Write a script that reads a real file from your own machine — not a toy example — and reports something true about it that you did not already know.
The question that unlocks the next lesson
Why is reading a real file from your own machine a better exercise than a prepared example?
- AReal files are larger, so the script runs faster
- BReal data is messy and inconsistent, which is the case your code must actually survive
- CPrepared examples cannot be opened in Python
- DIt avoids having to handle errors