Answers for "gzip read gz object"

2

python Decompress gzip File

import gzip
import shutil
with gzip.open('file.txt.gz', 'rb') as f_in:
    with open('file.txt', 'wb') as f_out:
        shutil.copyfileobj(f_in, f_out)
Posted by: Guest on May-15-2020
0

python gzip a file

import gzip
import shutil
with open('/home/joe/file.txt', 'rb') as f_in:
    with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:
        shutil.copyfileobj(f_in, f_out)
Posted by: Guest on December-25-2020

Python Answers by Framework

Browse Popular Code Answers by Language