Re: remove header line when reading/writing files

2007-10-12 Thread Marc 'BlackJack' Rintsch
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

remove header line when reading/writing files

2007-10-11 Thread RyanL
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

Re: remove header line when reading/writing files

2007-10-11 Thread Tim Chase
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

Re: remove header line when reading/writing files

2007-10-11 Thread Tim Chase
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

Re: remove header line when reading/writing files

2007-10-11 Thread timaranz
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

Re: remove header line when reading/writing files

2007-10-11 Thread Scott David Daniels
[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 =