Message125702
On "The Python Tutorial", section 10.9. Data Compression
http://docs.python.org/py3k/tutorial/stdlib.html#data-compression
>>> import zlib
>>> s = 'witch which has which witches wrist watch'
...
>>> t = zlib.compress(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: must be bytes or buffer, not str
Possible solution (sorry, newbie) are:
>>> s = b'witch which has which witches wrist watch'
or
>>> s = 'witch which has which witches wrist watch'.encode("utf-8")
At "The Python Standard Library", secction 12. Data Compression and Archiving
http://docs.python.org/py3k/library/zlib.html#module-zlib
apparently example is correct:
zlib.compress(string[, level]) |
|
Date |
User |
Action |
Args |
2011-01-07 20:02:51 | joseluisfb | set | recipients:
+ joseluisfb, docs@python |
2011-01-07 20:02:51 | joseluisfb | set | messageid: <1294430571.2.0.193589316262.issue10863@psf.upfronthosting.co.za> |
2011-01-07 20:02:48 | joseluisfb | link | issue10863 messages |
2011-01-07 20:02:48 | joseluisfb | create | |
|