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?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With