http://www.greenteapress.com/thinkpython/html/book015.html#toc159“rel=“nofollow noreferer”>a section in ,这大概是准确的书:,
A common use of pipes is to read a compressed file incrementally; that is, without uncompressing the whole thing at once. The following function takes the name of a compressed file as a parameter and returns a pipe that uses gunzip to decompress the contents:
def open_gunzip(filename): cmd = gunzip -c + filename fp = os.popen(cmd) return fp
If you read lines from fp one at a time, you never have to store the uncompressed file in memory or on disk.
也许我只是解释这一错误,但我看不到这一点是可能的。 灰 Python可能有任何手段通过淡化结果来铺平枪道? 我假定,在继续生产线之前,在一行产出之前,会把枪弹推向碎块,因此,有些缓冲必须抓住所有这些东西(无论是在杰里德语译员内部还是从书记处,无论是在记忆中还是在磁盘上),也就是说,未经压缩的档案正全部储存在,。