peter wrote:
> Example (one block in ascii file):
> $
> NAME='ALFA'
> CODE='x'
> $
>
> There are many similar blocks in the file with different NAMEs and
> different CODEs. What I'm looking for is a script that searchs through
> whole file and finds
At Wednesday 23/8/2006 09:48, peter wrote:
What I did is that I can find all strings which I need, next I change
these strings based on CODE, but what I can't is to replace old string
with new one, on the same position in the file. It always writes new
string at the end of the file. Here is my c
Take your code, pretend it is in file:
$
NAME='ALFA'
CODE='x'
$
a python functions could be:
def change(filename):
fp = open(filename, 'r')
lines = fp.readlines()
fp.close()
for i in range(len(lines)):
if lines[i].find('NA
Thank you for your advice.
I'm not so good in python yet, so could you be so kind and write me a
piece of code for the part
If you want the output to be written to same file just 'move' this
temperory file to the input file once you are done.
Because that's what I don't know how to do it. How
On 23 Aug 2006 05:48:37 -0700, peter <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I'm looking for an advice.
>
> Example (one block in ascii file):
> $
> NAME='ALFA'
> CODE='x'
> $
>
> There are many similar blocks in the file with different NAMEs and
Hello all,
I'm looking for an advice.
Example (one block in ascii file):
$
NAME='ALFA'
CODE='x'
$
There are many similar blocks in the file with different NAMEs and
different CODEs. What I'm looking for is a script that searchs through
whole file a