Skip to main content
Simpler formatting of links
Source Link
l0b0
  • 51.8k
  • 43
  • 213
  • 379

zlib [docs]zlib implements the compression used by gzip, but not the file format. Instead, you should use the gzip module [docs]gzip module, which itself uses zlib.

import gzip
s = '...'
with gzip.open('/tmp/data', 'w') as f:
    f.write(s)

zlib [docs] implements the compression used by gzip, but not the file format. Instead, you should use the gzip module [docs], which itself uses zlib.

import gzip
s = '...'
with gzip.open('/tmp/data', 'w') as f:
    f.write(s)

zlib implements the compression used by gzip, but not the file format. Instead, you should use the gzip module, which itself uses zlib.

import gzip
s = '...'
with gzip.open('/tmp/data', 'w') as f:
    f.write(s)
Post Migrated Here from stackoverflow.com (revisions)
Source Link
Jeremy
  • 1
  • 1
  • 4
  • 13

zlib [docs] implements the compression used by gzip, but not the file format. Instead, you should use the gzip module [docs], which itself uses zlib.

import gzip
s = '...'
with gzip.open('/tmp/data', 'w') as f:
    f.write(s)