我想使用Python來gzip文件。我正在嘗試使用subprocss.check_call(),但它與錯誤'OSError:[Errno 2]沒有這樣的文件或目錄'一直失敗。我在這裏嘗試的是否有問題?有沒有比使用subprocess.check_call更好的方式來gzip文件?在Python中使用gzip文件
from subprocess import check_call
def gZipFile(fullFilePath)
check_call('gzip ' + fullFilePath)
謝謝!!
爲什麼不能http://docs.python.org/library/gzip.html? – Ski
相關:從目錄'/ dir/path'創建一個gzipped tarball'archive.tar.gz',你可以使用'shutil.make_archive'('archive','gztar','/ dir/path')' – jfs