Another newbie question

Gene C gchiaramonte at yahoo.com
Sat Sep 30 10:11:29 EDT 2000


> 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.
Wait a year or 2!

> 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?

Without knowing what you are trying to do, take a look at cPickle or the
shelve module. You can also wrap a file in a class and write your own
__getitem__ method. (you can also do the reverse to write to files like they
were sequences too) Then you can loop through the file as if it was a
sequence. There's also the struct module for binary access.

Gene





More information about the Python-list mailing list