Skip to main content
Simpler formatting of links
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398

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
user1114
  • 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)