[Tutor] general basic question

Walter Prins wprins at gmail.com
Wed Feb 8 14:54:55 CET 2012

Hi Ken,

Welcome to Python and to programming in general.

On 8 February 2012 13:40, ken brockman <krush1954 at yahoo.com> wrote:
> Hello all:
> I have a general and very basic question if I may. I am in the process
> of attempting to write my first python app. I wanted to collect information
> and save it to lists and dictionaries. My question is, is it possible to
> save said lists and dictionaries in the program proper, or do i need to save
> the information to files on the hard drive.

You would save the information in files external and seperate to the
source code of your program.  Note however that you can in fact
directly serialize or persist (fancy object oriented terms that
basically means "to save to permanent storage, e.g. disk") Python
objects very easily with Python standard functionality, referred to in
Python terms as "pickling".  See the "pickle" module for  more
information:  http://docs.python.org/library/pickle.html Note that it
is more common for applications to use a database for data storage,
such as SQLite, Postgres, MySQL, SQL Server etc etc, rather than
simple pickling, but for simple cases it (or even simple text files)
might suffice.  It all depends on your requirements... ;)



More information about the Tutor mailing list