参考文档:https://docs.python.org/2/library/tarfile.html 1.压缩一个文件夹下的所有文件 #coding=utf8 import os import tarfile __author__ = 'Administrator'