> for x in range(1,226):
> # g=open('output', 'w')
> y1=m.extract('TEMP',32, 1131, component='1', cycle=x, subcycle=1)
> y2=m.extract('PRES',32, 1131, component='1', cycle=x, subcycle=1)
> # testout = (x,y1,y2,'\n')
> # line = str(testout)
> # g.write(line)
> print x,y1,y2
> # g.close()
>
You're opening the same file, 'output', 225 times and overwriting the
contents each time.
the write method of file access erases its previous contents.
you should use a variable for the filename,
I.E.
g = open('output%i' % x, 'w')
which will open output1, output2, output3, etc... for each time through
the loop,
or you should open the file before the loop begins and only have writes
inside the loop.
Then you can close the file after the loop exits.
HTH,
-Luke
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor