小编bal*_*ath的帖子

蟒蛇 3.6.3。zlib 压缩

我正在尝试使用 zlib 在 python 3.6.3 中压缩一个字符串,但是得到一个错误(TypeError: a bytes-like object is required, not 'str') ,它应该在 python 2.7- 版本上工作,这是我的简单代码:

import zlib
a='hellohellohelloheeloohegregrf'
b=zlib.compress(a)
print(b)
Run Code Online (Sandbox Code Playgroud)

compression zlib python-3.x

3
推荐指数
1
解决办法
1328
查看次数

标签 统计

compression ×1

python-3.x ×1

zlib ×1