Concatenate gzipped files with Python, on Windows
问题 Is there a memory-efficient way to concatenate gzipped files, using Python, on Windows, without decompressing them? According to a comment on this answer, it should be as simple as: cat file1.gz file2.gz file3.gz > allfiles.gz but how do I do this with Python, on Windows? 回答1: Just keep writing to the same file. with open(..., 'wb') as wfp: for fn in filenames: with open(fn, 'rb') as rfp: shutil.copyfileobj(rfp, wfp) 回答2: You don't need python to copy many files to one. You can use standard