© Irv Kalb 2016

Irv Kalb, Learn to Program with Python, 10.1007/978-1-4842-2172-3_9

9. File Input/Output

Irv Kalb

(1)Mountain View, California, USA

In every program that we have talked about so far, when the program ends, the computer forgets everything that happened in the program. Every variable you created, every string you used, every Boolean, every list-it’s all gone. But what if you want to keep some of the data that you generate in a program, and save it for when you run the program later? Or, maybe you want to save some data so that a different program could use the data that you generated.

If you want to keep some information around between runs of a program, you need a way of having what is called persistent data-you want the data to remain ...

Get Learn to Program with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.