Store a variable permanently

Steven D'Aprano steve+comp.lang.python at
Fri Mar 1 04:44:30 CET 2013

On Thu, 28 Feb 2013 19:35:57 -0800, eli m wrote:

> So i have a variable called funds that i want to store the value of even
> after the program is exited. My funds variable holds the total value of
> funds i have. I add a certain number of funds each time i run the
> program by entering how much i want to add. How would i store the funds
> variable to keep its value?

You have to write it to a file, then read it back in when the program 

Do you need help with reading and writing files?

Perhaps the easiest way to do this is with the configparser or plistlib 


More information about the Python-list mailing list