zlib module

2017-08-29  本文已影响0人  cutelittlePanda

import zlib

zlib.compress(data, level=-1) : return a bytes object containing the compressed data;

* data should be in bytes type, if not, convert it to, such as type 'str' to type 'bytes' with command 'str.encode(string_data)';

* the return is also a bytes object, can convert it to str using command 'bytes_obj.decode()';

following snapshot is the coding sample;

zlib.compress(bytes_data, level)
上一篇下一篇

猜你喜欢

热点阅读