On Fri, 28 Jan 2011, Dylan Reinhardt wrote:
To get a list of the concatenated values for column 0, 1, 2... how about:--- column_values = list() for col in range(3): # or whatever column_values.append(' '.join([row[col] for row in reader]))
If you have a very large amount of data, it might be worth the extra time to do it in one pass... but the above might be good enough for the task at hand.
Dylan, Thanks. I'll give this some thought. My initial idea was to read each line into a separate list, then extract items from each list in sequence and write them out as a row in the output file. Because the first two rows of the input file lack values in the first column the indexing would not be simple, but could be figured out by trial-and-error. Rich _______________________________________________ Portland mailing list [email protected] http://mail.python.org/mailman/listinfo/portland
