import zlib
compressor = zlib.compressobj(method=zlib.DEFLATED, wbits=zlib.MAX_WBITS | 16)
with open('output.txt', 'wb') as fd:
for i in range(10000):
fd.write(compressor.compress(f"Line number {i}\n".encode('utf-8')))
fd.write(compressor.flush())
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can create gzip compatible output like this