📜  压缩 tarfile python 代码示例

📅  最后修改于: 2022-03-11 14:46:39.987000             🧑  作者: Mango

代码示例1
import tarfile
import os.path

def make_tarfile(output_filename, source_dir):
    with tarfile.open(output_filename, "w:gz") as tar:
        tar.add(source_dir, arcname=os.path.basename(source_dir))