On Dec 17, 2007, at 5:34 AM, Horacius ReX wrote: > 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 ?
AFAIK, there really isn't much you can do to *speed* the reading and writing of the large text file. But maybe you can avoid doing it too much. If you must make many changes it might help to just keep a list of lines to consider "deleted" -- and write the modified file out later. hth, Michael --- "I use tuples simply because of their mellifluous appellation." --Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list