python tar怎么安装
收起
云计算小粉
2018-05-10 20:10:28
1808
0
1
条回答
写回答
取消
提交回答
-
import tarfile
import os
def tar(fname):
t = tarfile.open(fname + ".tar.gz", "w:gz")
for root, dir, files in os.walk(fname):
print root, dir, files
for file in files:
fullpath = os.path.join(root, file)
t.add(fullpath)
t.close()
if __name__ == "__main__":
tar("del")
2019-07-17 22:20:48