ZLIB decompressing only portion of data

mkx at excite.com mkx at excite.com
Tue Feb 20 23:34:22 CET 2001


I am experimenting with the ZLIB module to decompress some .ZLB files
I have acquired. The script below properly decompresses only the first
segment of the compressed file. For example, a 10KB .ZLB comressed
file only returns a 546 character string from the example below.

What have I done wrong?


###
import os, zlib

fd=os.open('d:/temp/zlb/snippets.zlb', os.O_RDONLY | os.O_BINARY )

ch=os.read(fd,1)
while ch:
    zlb=zlb+ch
    ch=os.read(fd,1)
os.close(fd)

print len(zlb)

str = zlib.decompress(zlb)
print str
print len(str)






More information about the Python-list mailing list