Deleting lines from a file
Diez B. Roggisch
deets at nospam.web.de
Mon Dec 17 08:38:02 EST 2007
Horacius ReX wrote:
> and regardless of the speed, what do you think would be the best
> method to do this ?
Without more information about the contents of the file and who's reading
them, we can't say more.
if the reader is not under your control & doesn't deal with deletion-marks
or anything such in the file, you can't do anything but really delete the
lines.
If you can control it, it depends on how you process the file - has it fixed
line length, or not, and so forth. Because you need to use seek to position
the file-pointer to the proper location in the file to write a deletion
mark, but to do so you of course need to determine it first - and that will
need to be done in a two-pass apporach most probably.
Diez
More information about the Python-list
mailing list