On Thu, 11 Oct 2007 22:52:55 +, RyanL wrote:
I'm a newbie with a large number of data files in multiple
directories. I want to uncompress, read, and copy the contents of
each file into one master data file. The code below seems to be doing
this perfectly. The problem is each of the
I'm a newbie with a large number of data files in multiple
directories. I want to uncompress, read, and copy the contents of
each file into one master data file. The code below seems to be doing
this perfectly. The problem is each of the data files has a header
row in the first line, which I do
each file into one master data file. The code below seems to be doing
this perfectly. The problem is each of the data files has a header
row in the first line, which I do not want in the master file. How
can I skip that first line when writing to the master file? Any help
is much
Forgot the enumerate call of all things
for zipfile in filelist:
for i, line in enumerate(gzip.Gzipfile(zipfile,'r')):
if i: outfile.write(line)
Some days, I'm braindead.
-tkc
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 12, 12:23 pm, Tim Chase [EMAIL PROTECTED] wrote:
Forgot the enumerate call of all things
for zipfile in filelist:
for i, line in enumerate(gzip.Gzipfile(zipfile,'r')):
if i: outfile.write(line)
Some days, I'm braindead.
-tkc
I would move the 'if' test outside the
[EMAIL PROTECTED] wrote:
...
for zipfile in filelist:
zfiter = iter(gzip.Gzipfile(zipfile,'r'))
zfiter.next() # ignore header line
for i, line in enumerate(fziter):
outfile.write(line)
Or even:
writes = outfile.write
for zipfile in filelist:
zfiter =