On Tue, Mar 1, 2011 at 11:55 AM, Sean Carolan <scaro...@gmail.com> wrote: > Maybe someone can help with this. I have a function that takes a > single file as an argument and outputs a tuple with each line of the > file as a string element. This is part of a script that is intended > to concatenate lines in files, and output them to a different file.
Not sure if this is the "right" or best way to do this, but I ended up using vars() to assign my variable names, like so: import sys myfiles = tuple(sys.argv[1:]) numfiles = len(myfiles) varlist = [] def makeTuple(file): 6 lines: outlist = [] ---------- for i in range(numfiles): varlist.append('tuple'+str(i)) vars()[varlist[i]] = makeTuple(myfiles[i]) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor