<div>Max - Thanks for your reply. The text files are not in csv format and I will need to figure out how to separate the fields. Space as a separator will not work as values&nbsp;have spaces in them. The current text file I am looking at&nbsp;seems&nbsp;to have fields&nbsp;that are&nbsp;at fixed width and the&nbsp;each line I want are encapsulated in &quot;&quot;. The example you showed below will be usefull once I accomplish the above task.
</div>
<div>&nbsp;</div>
<div>Chris -&nbsp;Thank you for your reply. The link you provided&nbsp;have&nbsp;some examples of file and string manipulation&nbsp;which will be&nbsp;a very useful read.</div>
<div>&nbsp;</div>
<div>Alden<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 5/16/07, <b class="gmail_sendername">Max Slimmer</b> &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:max@theslimmers.net" target="_blank">max@theslimmers.net</a>
&gt; wrote:</span> 
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">You indicated you receive text files, if they are comma delimited you can parse them with the csv library and thus read them into python lists of lists 
</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">onece you have your data in a list of lists you could simply operate on it there or you could create objects from each list element leaving you with a list of objects exch representing one row. 
</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">say you keep it simple and you have incoming data consisting of name, rate, amt. </font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">&gt;&gt;&gt; data = [[&#39;name1&#39;,12.5, 123.66],[&#39;name2&#39;,5.6,421]]</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">&gt;&gt;&gt; data</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">[[&#39;name1&#39;, 12.5, 123.66], [&#39;name2&#39;, 5.5999999999999996, 421]]</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">you can sum all the amt&#39;s with </font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">&gt;&gt;&gt; tot = sum(row[2] for row in data)</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">&gt;&gt;&gt; tot<br>544.65999999999997</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">or you can sort the data by rate:</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">&gt;&gt;&gt; data.sort(key=lambda i:i[1])&nbsp;&nbsp; # see <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305304" target="_blank">
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305304</a>&nbsp;for interesting things to do with sort</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">&gt;&gt;&gt; data<br>[[&#39;name2&#39;, 5.5999999999999996, 421], [&#39;name1&#39;, 12.5, 123.66]]</font></span></div>
<div dir="ltr" align="left"><span></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">play with the interactive interpreter </font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">max</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div><br>
<blockquote dir="ltr" style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<div lang="en-us" dir="ltr" align="left">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:baypiggies-bounces@python.org" target="_blank">baypiggies-bounces@python.org</a> [mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:baypiggies-bounces@python.org" target="_blank">
 baypiggies-bounces@python.org</a>] <b>On Behalf Of </b>Alden Meneses<br><b>Sent:</b> Wednesday, May 16, 2007 10:45 AM<br><b>To:</b> <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:baypiggies@python.org" target="_blank">
baypiggies@python.org</a><br><b>Subject:</b> [Baypiggies] newbie question - automating my reporting tasks<br></font><br>&nbsp;</div>
<div><span>
<div></div>
<div>Hello all,</div>
<div>&nbsp;</div>
<div>It does seem that Python is easier to lean than PERL. and I like the interpreter.</div>
<div>&nbsp;</div>
<div>I have some text files that I download from an AS400 and format with Excel. Basically I convert the text to columns then sort and subtotal. The results are then emailed to various people and also used&nbsp;in other reports. Haven&#39;t really thought out how to automate this whole process but wanted to start with a project to learn python and go from there. 
</div>
<div>&nbsp;</div>
<div>I have skimmed throught the python tutorial and now getting into python in a nutshell, 2nd edition and would welcome any thoughts or suggestions in getting my project off the ground. I&#39;ve taken programming courses&nbsp;in college&nbsp;- C, C++, PERL, FORTRAN, PASCAL, UNIX shell scripting and its been awhile since I had to rely on it. 
</div>
<div>&nbsp;</div>
<div>Thanks in advance,</div>
<div>Alden</div></span></div></blockquote></div></blockquote></div><br>