[Tutor] Dynamically assign variable names to tuple objects

Sean Carolan scarolan at gmail.com
Tue Mar 1 19:59:49 CET 2011

> I saw in your follow-up that you went straight for vars().  I really
> don't think that's what you wish to use.  Get rid of vars(), he had
> to go to jail.  Don't go visit vars() again for at least two months,
> then maybe he'll be out on probation.

Thanks Martin and Hugo.  As you can tell I'm no python guru.  Maybe I
should take a step back and explain exactly what it is I'm trying to
do.  I know this can be done quickly with awk or even perl but I want
to get more practice with python.  So here's the basic idea:

Take an arbitrary number of text files. Assume that each text file has
the exact same number of lines.  Concatenate each line of each file
with the corresponding lines of the other files and output the data.
So in other words, the first line of output will be
file1_line1+file2_line1+file3_line1, etc.

I'll work on this some more and see what I can come up with.

More information about the Tutor mailing list