Another newbie question

pehr anderson pehr at pehr.net
Sun Oct 1 23:14:48 EDT 2000


Dear Prospero, 

You have three main options for storing data in files:

#1 use a simple ASCII file format that is easy to 
read and understand. This is the best solution for
long-term us as the next developer to see your project
will know exactly what is going on.  If you have tables of data,
then next step up is a "CSV" file (Comma Separated Values)
And if you need structured data, the popular thing to do is 
use XML, with or without a data type definition.
Supporting the # comment character is useful if your data is
at all readable by humans.

#2 Use the built-in serialization code in python
to pickle the objects. This makes it easy to write out 
and read back.  You will have to learn a bit more about
python, but that will be a lot of fun!

#3. Use some wierdo unspecified binary format that will cause
everybody to hate you forever.  Most developers seem to be
moving away from this approach.



Prospero wrote:
> 
> Greetings!
> 
> Firstly, thanks to all who answered my first question. After four days
> playing with Python I know more about it than I do about Java after as many
> months.
> 
> My new question has to do with files. I am working on a project which will
> involve several very large files of grouped integers. I can see how to
> create the files as text and convert to and from integers but surely there
> must be a better solution than this. I have tried the tutorials and what
> example files I can find, so far without success. Can someone point me in
> the right direction?
> 
> All the best,
> 
> Prospero.
> 
> "Never be bullied into silence. Never allow yourself to be made a victim.
> Accept no one's definition of your life; define yourself."
> --Harvey Fierstein
> 
> Prospero's World:  http://www.bigwig.net/prospero



More information about the Python-list mailing list