input file format

Etay etay.rosenzweig at gmail.com
Tue Aug 9 23:00:02 EDT 2011


Hi all,

I am trying to write a Python script which will read the output file
of a numerical model, and then copy some of that information into a
new file in a new format. The output file of the numerical model is
basically

54321  # number of points
1234  # number of time steps

__a whole bunch of lines with info I don't need__

[TIMESTAMP] 001
1  10  10
2  10  11
3  11  11
etc... in the format: Point#  X  Y for all 54321 points
[TIMESTAMP] 002
1  13  13
2  14  13
etc... for all 54321 points

and so for each of the 1234 time steps

I would like to be able to save the number of points and time steps,
then move all the time stamped data into a new file, but it needs to
be written there as [ Pt#  Y  X ].

Is there some simple way to skip over the lines I don't need, and then
inform Python about the format of the lines with the data I do need
within a loop?

Thanks!
Etay



More information about the Python-list mailing list