On Wed, Feb 25, 2009 at 1:53 PM, Alan Gauld wrote:
>
> "Bala subramanian" wrote
>
>> query 1) How should i overwrite the input file
>> I want to open 5 files one by one, do some operation on the lines and
>> write
>> the modified lines on the same file (overwritting). Can some please tell
>> me
>
"Bala subramanian" wrote
query 1) How should i overwrite the input file
I want to open 5 files one by one, do some operation on the lines
and write
the modified lines on the same file (overwritting). Can some please
tell me
how to do it.
You don't really want to do that! Too risky.
Better
On Wed, Feb 25, 2009 at 8:26 AM, Noufal Ibrahim wrote:
> Bala subramanian wrote:
>>
>> Hello all,
>>
>> query 1) How should i overwrite the input file
>> I want to open 5 files one by one, do some operation on the lines and
>> write the modified lines on the same file (overwritting). Can some plea
A.T.Hofkamp wrote:
write the output to a temporary file while reading the input, then
rename the temporary file.
This I believe is what the fileinput module does when you use it with
the inplace parameter set to 1.
--
~noufal
http://nibrahim.net.in/
Bala subramanian wrote:
Hello all,
query 1) How should i overwrite the input file
I want to open 5 files one by one, do some operation on the lines and
write the modified lines on the same file (overwritting). Can some
please tell me how to do it.
import fileinput
pat1=" R"
pat2="U5"
pat3="A
Bala subramanian wrote:
Hello all,
query 1) How should i overwrite the input file
I want to open 5 files one by one, do some operation on the lines and write
the modified lines on the same file (overwritting). Can some please tell me
how to do it.
You cannot write output to a file if you need
Hello all,
query 1) How should i overwrite the input file
I want to open 5 files one by one, do some operation on the lines and write
the modified lines on the same file (overwritting). Can some please tell me
how to do it.
pat1=" R"
pat2="U5"
pat3="A3"
from sys import argv
files=argv[1:]
for nam