remove header line when reading/writing files

Scott David Daniels Scott.Daniels at Acm.Org
Fri Oct 12 04:59:09 CEST 2007


timaranz at gmail.com 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 = iter(gzip.Gzipfile(zipfile,'r'))
       zfiter.next()  # ignore header line
       for line in zfiter:
           writes(line)



More information about the Python-list mailing list