> 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 appreciated. Thank you. [snip] > for zipfile in filelist: > filein = gzip.GzipFile(zipfile,'r') > filecontent = filein.read() > filein.close() > outfile.write(filecontent)
for zipfile in filelist: for i, line in gzip.Gzipfile(zipfile,'r'): if i: outfile.write(line) should do the trick for you. If you like a little more readable code, you can change that line to if i <> 0: outfile.write(line) or if i == 0: continue outfile.write(line) whichever you like. -tkc -- http://mail.python.org/mailman/listinfo/python-list