Re: Writing at the beginning of a file

2005-09-14 Thread Terry Reedy
"Thierry Lam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there an easy way to write something of variable length at the top > of the file? ... > The other way to do what I want is to write the whole thing to a new > file, but I want to skip that method if there's an alternat

Re: Writing at the beginning of a file

2005-09-14 Thread Bengt Richter
On 14 Sep 2005 07:13:50 -0700, "Thierry Lam" <[EMAIL PROTECTED]> wrote: >Let's say I already wrote a file and have the following: > >testing >testing testing >testing testing testing > >Is there an easy way to write something of variable length at the top >of the file? > >For example, > >6 testing

Re: Writing at the beginning of a file

2005-09-14 Thread Grant Edwards
On 2005-09-14, Thierry Lam <[EMAIL PROTECTED]> wrote: > Let's say I already wrote a file and have the following: > > testing > testing testing > testing testing testing > > Is there an easy way to write something of variable length at the top > of the file? No. [...] > The other way to do what I

Re: Writing at the beginning of a file

2005-09-14 Thread Paul McGuire
Thierry - Check out the StringIO module. It will allow you to buffer the whole file into a string, and then give you a pseudo file pointer to the string buffer, so that your "fp.write"s will work unchanged. -- Paul -- http://mail.python.org/mailman/listinfo/python-list

Writing at the beginning of a file

2005-09-14 Thread Thierry Lam
Let's say I already wrote a file and have the following: testing testing testing testing testing testing Is there an easy way to write something of variable length at the top of the file? For example, 6 testing written testing testing testing testing testing testing I tried to write some garba