> My advice would be to go read up on the zip() function and the > str.join() function. Then, if you are using python 2.x, go find > itertools.izip. It does the same thing as zip but it's more memory > efficient. With those two you can do it in about two lines or so (and > maybe a few for set up and clarity and such).
This is what I've got so far: import sys myfiles = sys.argv[1:] for i in zip(open(myfiles[0]), open(myfiles[1]), open(myfiles[2])): print " ".join(i) How would you: 1. zip an arbitrary number of files in this manner? I hard-coded it to do only three. 2. Strip out trailing spaces and line breaks from the lines in each file? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor