<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>Printing columns of data</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">Hello all,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp; I am writing a program to take a data file, divide it up into columns and print the information back with headers. The data files looks like this</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0 -3093.44908 -3084.59762&nbsp;&nbsp; 387.64329&nbsp;&nbsp;&nbsp; 26.38518&nbsp; 0.3902434E+00 -0.6024320E-04&nbsp; 0.4529416E-05</FONT>

<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.0 -3094.09209 -3084.52987&nbsp;&nbsp; 391.42288&nbsp;&nbsp; 105.55994&nbsp; 0.3889897E+00 -0.2290866E-03&nbsp; 0.4187074E-03</FONT>

<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.0 -3094.59358 -3084.88826&nbsp;&nbsp; 373.64911&nbsp;&nbsp; 173.44885&nbsp; 0.3862430E+00 -0.4953443E-03&nbsp; 0.2383621E-02</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">etc&#8230;</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">10.0 ...</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">So I wrote the program included below and it only prints the last line of the file.</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">Timestep&nbsp;&nbsp;&nbsp; PE</FONT>

<BR><FONT SIZE=2 FACE="Courier New">10.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -3091.80609 </FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">I have one question. Do I need to put ts and pe into a list before I print then to screen or I am just missing something. Thanks.</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">Ara</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">import string</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">inp = open(&quot;fort.44&quot;,&quot;r&quot;)</FONT>

<BR><FONT SIZE=2 FACE="Arial">all_file = inp.readlines()</FONT>

<BR><FONT SIZE=2 FACE="Arial">inp.close()</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">outp = open(&quot;out.txt&quot;,&quot;w&quot;)</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">cols = map(string.split,all_file)</FONT>

<BR><FONT SIZE=2 FACE="Arial">##print cols</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Data = {}</FONT>

<BR><FONT SIZE=2 FACE="Arial">for line in cols:</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; ts = line[0]</FONT>

<BR><FONT SIZE=2 FACE="Arial">#&nbsp;&nbsp;&nbsp; print line[0]</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; pe = line[1]</FONT>

<BR><FONT SIZE=2 FACE="Arial">#&nbsp;&nbsp;&nbsp; print line[1]</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">print &quot;&quot;&quot;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Timestep&nbsp;&nbsp;&nbsp; PE&quot;&quot;&quot;</FONT>

<BR><FONT SIZE=2 FACE="Arial">print &quot;%s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %s&nbsp;&nbsp;&nbsp;&nbsp; &quot; % (ts,pe)</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Arial">outp.close()</FONT>
</P>

</BODY>
</HTML>