On 10/14/2010 10:44 AM, Christopher Steele wrote:
The issue is that I need to be able to both, split the names of the files so that I can extract the relevant times, and open each individual file and process each line individually. Once I have achieved this I need to append the sorted files onto one another in one long file so that I can pass them into a verification package. I've tried changing the name to textline and I get the same result
I'm very happy to hear that changing the name of a variable did not affect the way the program works! Anything else would be worrisome.
- the sorted files overwrite one another.
Variable *time* names a list, with one member for each input file. But variable *newtime* names a scalar value, not a list. That looks like a problem to me. Either of the following changes might help:
Original: for x in time: hour= x[:2] print hour newtime = year+month+day+'_'+hour+'00' Alternative #1: newtime = [] for x in time: hour= x[:2] print hour newtime.append(year+month+day+'_'+hour+'00') Alternative #2: newtime = [year + month + day + '_' + x[:2] + '00' for x in time] HTH, John -- http://mail.python.org/mailman/listinfo/python-list