Deleting lines from a file
Michael Bentley
michael at jedimindworks.com
Mon Dec 17 08:15:14 EST 2007
More information about the Python-list mailing list
Mon Dec 17 08:15:14 EST 2007
- Previous message (by thread): Deleting lines from a file
- Next message (by thread): Deleting lines from a file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): Deleting lines from a file
- Next message (by thread): Deleting lines from a file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list