Reading and Writing Files

Overview


By the end of the last part, you reorganized your study log into a small set of named, tested functions. The program is now cleaner to read, easier to change, and ready for the next thing it has been missing all along: a way to remember what you logged.

So far, every run of the program has started from scratch. You enter sessions, the program reacts to them, and then the program ends — and the next time you start it, the sessions are gone. The sandbox cannot help with this. It runs your code, but it forgets everything the moment it closes.

This part is about leaving the sandbox. You move the project onto your own computer, install Python locally, and learn to read and write files — the mechanism programs use to remember things between runs. By the end of this part, your study log will save your sessions to a file on disk, load them back the next time you start it, and behave like a small but real piece of software.

The structure of this part is as follows:

Finally, the recap and feedback chapter at the end of the part briefly summarizes what was covered and asks for feedback.

  1. read Working on Your Own Computer and complete the installation,
  2. then read the regular chapters in order, completing exercises as you go,
  3. then complete the project checkpoint in Making Your Study Log Persistent,
  4. and finish with the recap and feedback.

The installation step is the only part of the course where things vary by operating system. Allow a little more time for it if it is your first time setting up Python locally.