Brad wrote:
alex23 wrote:
open('outfile','w').writelines(l.replace('Volume 940','Volume 950')
for l in open('myfile','r'))
Ahh yes, perhaps string function are simpler to use in this case.
Thanks Alex!
If, if you have to change the file repeatedly, make it a template
(either % or the ne
alex23 wrote:
On Aug 12, 12:03 pm, Brad <[EMAIL PROTECTED]> wrote:
So let's say I want to edit this file and change Volume from 940 to 950.
Personally, I'd recommend avoiding re and sticking with the standard
string functions.
Something like this should be pretty effective:
open('outfile','
On Aug 12, 12:03 pm, Brad <[EMAIL PROTECTED]> wrote:
> So let's say I want to edit this file and change Volume from 940 to 950.
Personally, I'd recommend avoiding re and sticking with the standard
string functions.
Something like this should be pretty effective:
>>> open('outfile','w').writeline
Hi, what I'd like to do is edit an input file for a calculation with
Python. Let's say that I have an input file like the following
-->>
BLAH BLAH BLAH
Other inputs, Volume 940 m^3, maybe some more stuff
STUFF STUFF
-->>
So let's say I