如何在Python中gzip压缩字符串? [英] How do I gzip compress a string in Python?
本文介绍了如何在Python中gzip压缩字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Python中gzip压缩字符串?
How do I gzip compress a string in Python?
gzip.GzipFile
存在,但这是文件对象 - 用纯字符串怎么样?
gzip.GzipFile
exists, but that's for file objects - what about with plain strings?
推荐答案
从 http: //docs.python.org/library/archiving.html - gzip或zlib,具体取决于您的确切需求。
Pick a suitable module from http://docs.python.org/library/archiving.html -- either gzip or zlib, depending on your exact needs.
这篇关于如何在Python中gzip压缩字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文