In programming, there’s no getting away from disk files—or rather just “files,” because these days files are not necessarily restricted to disk files. In any case, they’re essential, because they store data that doesn’t go away after the program ends. Everything from credit databases to police records depend on file storage.
Python facilities for reading and writing to files are especially easy. Some take advantage of the Python concept of iterable, which makes everything easier once you understand it.
In this chapter, I’ll introduce simple techniques for reading and writing text files.
Text vs. binary files
The op system (os) module ...