Store a variable permanently

Michael Torrie torriem at gmail.com
Fri Mar 1 15:42:38 CET 2013


On 03/01/2013 03:19 AM, Jean-Michel Pichavant wrote:
> I would serialize the data.
> 
> http://docs.python.org/2/library/pickle.html
> 
> funds=5 pickle.dump(funds, 'funds.pickle')
> 
> # to reload funds:
> 
> funds = pickle.load('funds.pickle')
> 
> 
> The good thing with pickle is that it serializes a lot of things, see
> the "What can be pickled" section of the doc.

Another solution is to use a database system.  Either SQLite
(file-based) or something server-based like PosgreSQL or MariaDB.



More information about the Python-list mailing list