insert line in middle of file

Kragen Sitaker kragen at dnaco.net
Mon Apr 2 13:54:53 EDT 2001


In article <9aacgo$7da$1 at solaria.cc.gatech.edu>,
Holland King  <insanc at cc.gatech.edu> wrote:
>i have a file that must have some stuff at the beginning and the end and i 
>need to add a line to the middle. is there any easy way to do this without
>losing data? thank you.

Copy the beginning to a new file, write the added line to the new file,
and copy the end to the new file.  Then rename the new file to have the
same name as the old one.

-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Perilous to all of us are the devices of an art deeper than we possess
ourselves.
       -- Gandalf the White [J.R.R. Tolkien, "The Two Towers", Bk 3, Ch. XI]




More information about the Python-list mailing list