Books Database

Alex Martelli aleaxit at yahoo.com
Thu Mar 6 11:05:39 EST 2003


On Thursday 06 March 2003 05:01 pm, Eliran Gonen wrote:
> Alex Martelli <aleaxit at yahoo.com>:
> >     thefile.seek(0)
> >     lines = [ '|'.join(fields) for fields in db ]
> >     thefile.write('\n'.join([ lines ]))
> >     thefile.close()
>
> Hmm, OK I will see what I can do.
>
> What about removing a specific _line_ from the db ?
> I thought about counting \n's.

NAH!  Why do so much work?!  Just read the db into
memory, remove whatever you want from the db
_variable_, and overwrite as above.  At 30KB file size,
or even quite a bit more, that will be lightning-fast.


Alex







More information about the Python-list mailing list