<!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 5.5.2657.73">
<TITLE>Data format question</TITLE>
</HEAD>
<BODY>

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

<P><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp; I am writing a filter program that reads a column of data, converts it and then writes it to another file. I was wondering how do you convert a column of data (for example multiply the column by a number or replace the letter A with a number) and how does one maintain a column format in the new output file? Also any suggested readings either on-line or books on text file handling in Python would be appreciated. I have read through some of the tutorials on python.org and read the python grimore. Thanks.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Ara</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Here is a part of the code for pulling out a column of data and then writing it to new file.</FONT>
</P>

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

<P><FONT SIZE=2 FACE="Arial">for line in inp.readlines():</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; words = line.split()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #thanks to orbitz for this line</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; if len(words) &gt;= 1: </FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outp.write(words[0])&nbsp; </FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&quot;There is something to be learned from a rainstorm. When meeting with a sudden shower, you try not to get wet and run quickly along the road. But doing such things as passing under the eaves of houses, you still get wet. When you are resolved from the beginning, you will not be perplexed, though you still get the same soaking.&quot; - Yamamoto Tsunetomo</FONT></P>

</BODY>
</HTML>