Python 中如何压缩文件


Author: yifei / Created: June 22, 2018, 10:02 p.m. / Modified: June 22, 2018, 10:03 p.m. / Edit

basic usage

import gzip/bz2 with gzip.open('file.gz', 'rt') as f: text = f.read()

NOTE: the default mode is binary.


有任何问题可以发邮件到 kongyifei (at) gmail.com 讨论