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 loop :
for zipfile in filelist:
zfiter = iter(gzip.Gzipfile(zipfile,'r'))
zfiter.next() # ignore header line
for i, line in enumerate(fziter):
outfile.write(line)
I'm not sure if the iter(...) is required. This will raise a
StopIteration exception if zipfile is empty.
Cheers
Tim
--
http://mail.python.org/mailman/listinfo/python-list