Deprecated since 3.9. Opening GzipFile for writing without specifying the mode argument is deprecated.
The GzipFile class simulates most of the methods of a file object with
the exception of the truncate() method.
This class only supports opening files in binary mode. If you need to
open a compressed file in text mode, use the gzip.open() function.
Changed in 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.12, 3.15
3.1: Support for the with statement was added, along with the mtime constructor argument and mtime attribute.
3.2: Support for zero-padded and unseekable files was added.
3.3: The io.BufferedIOBase.read1() method is now implemented.
3.4: Added support for the 'x' and 'xb' modes.
3.5: Added support for writing arbitrary bytes-like objects. The read() method now accepts an argument of None.
3.6: Accepts a path-like object.
3.12: Remove the filename attribute, use the name attribute instead.
3.15: The default compression level was reduced to 6 (down from 9). It is the default level used by most compression tools and a better tradeoff between speed and performance.