【发布时间】:2011-12-30 16:46:54
【问题描述】:
我想用 Python 压缩一个文件。我正在尝试使用 subprocss.check_call(),但它一直失败并出现错误“OSError: [Errno 2] No such file or directory”。我在这里尝试的有问题吗?有没有比使用 subprocess.check_call 更好的压缩文件的方法?
from subprocess import check_call
def gZipFile(fullFilePath)
check_call('gzip ' + fullFilePath)
谢谢!!
【问题讨论】:
-
相关:要从目录
/dir/path创建一个压缩包archive.tar.gz,你可以使用shutil.make_archive('archive', 'gztar', '/dir/path')
标签: python gzip subprocess