<br><br><div class="gmail_quote">On Tue, Mar 1, 2011 at 1:59 PM, Sean Carolan <span dir="ltr">&lt;<a href="mailto:scarolan@gmail.com">scarolan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">&gt; I saw in your follow-up that you went straight for vars().  I really<br>
&gt; don&#39;t think that&#39;s what you wish to use.  Get rid of vars(), he had<br>
&gt; to go to jail.  Don&#39;t go visit vars() again for at least two months,<br>
&gt; then maybe he&#39;ll be out on probation.<br>
<br>
</div>Thanks Martin and Hugo.  As you can tell I&#39;m no python guru.  Maybe I<br>
should take a step back and explain exactly what it is I&#39;m trying to<br>
do.  I know this can be done quickly with awk or even perl but I want<br>
to get more practice with python.  So here&#39;s the basic idea:<br>
<br>
Take an arbitrary number of text files. Assume that each text file has<br>
the exact same number of lines.  Concatenate each line of each file<br>
with the corresponding lines of the other files and output the data.<br>
So in other words, the first line of output will be<br>
file1_line1+file2_line1+file3_line1, etc.<br>
<br>
I&#39;ll work on this some more and see what I can come up with.<br>
<div><div></div><div class="h5">_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</div></div></blockquote></div><br>Just some quick ideas:<br><br>Read about Generators.  Using Hugo&#39;s snippet for reading a file a line at a time, you can write a function to yield a single line of the file for each call.  Do this for as many files as you are combining, and concatinate the lines each pass.  Then write to your outfile<br clear="all">
<br>-- <br>Joel Goldstick<br><br>