在python中将文件压缩成不同的部分 [英] Compress a file into different parts in python

查看:73
本文介绍了在python中将文件压缩成不同的部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Python(最好是2.7版)中,是否可以将文件压缩为几个大小相同的 .zip 文件?

Is it a way in Python (2.7 preferably) to compress a file in several equally-sized .zip files??

结果将类似于:(假设选择了200MB,并压缩了1100MB的文件)

The result would be something like: (lets assume 200MB selected and compressing a file of 1100MB)

compressed_file.zip.001 (200MB)
compressed_file.zip.002 (200MB)
compressed_file.zip.003 (200MB)
compressed_file.zip.004 (200MB)
compressed_file.zip.005 (200MB)
compressed_file.zip.006 (100MB)


推荐答案

我认为您可以在shell命令中执行此操作。像这样的东西

I think you can do it in shell command. Somthing like

gzip -c /path/to/your/large/file | split -b 150000000 - compressed.gz

,您可以从python执行shell。

and you can execute shell from python.

问候

Ganesh J

这篇关于在python中将文件压缩成不同的部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆