modify a file

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sun Nov 4 10:53:28 EST 2007


On Mon, 05 Nov 2007 01:55:50 +1100, tech user wrote:

> I have a file which is large about 3.5G.
> I need to modify some lines in it,but I don't like to create another file
> for the result.
> How can i do it? thanks.

In general not a good idea unless the modification does not change the
length of the lines.  If it does, everything behind that line must be
copied within the file, either "up" before the modification to make room
or "down" after the modification to close a gap.  If anything goes wrong
while moving/copying the data you are left with a 3.5G file that may be
broken.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list