File processing

Lutz Schroeer Lutz.Schroeer at kybernetik-manufaktur.de
Mon Jul 9 17:30:13 EDT 2001


"Chris McMillan" <christopherjmcmillan at eaton.com> wrote in
news:9id5p9$8r62 at interserv.etn.com: 

> I'm trying to write a script that will open a file, delete the first
> line, and then save the file with the same name.  Can someone please
> point me in the right direction?  Thanks!

* open source file, 'r'
* open temporary destination file, 'w'
* read first line of source file, throw it away
* read remaining source file lines and write them to destination file
* delete source file
* rename destination file to old source file name

There are several variations of implementation but this raodmap should guide 
you to the right direction.

latz



More information about the Python-list mailing list