Deleting lines from a file
Diez B. Roggisch
deets at nospam.web.de
Mon Dec 17 07:41:48 EST 2007
Horacius ReX wrote:
> Hi,
>
> I need to write a program which reads an external text file. Each time
> it reads, then it needs to delete some lines, for instance from second
> line to 55th line. The file is really big, so what do you think is the
> fastest method to delete specific lines in a text file ?
Not using a file but a database instead. If that's not possible, you can't
do anything but open/read/filter/write - filesystems (at least not the
known ones) don't support random deletion.
Diez
More information about the Python-list
mailing list