client.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:LMDocker-project 作者: xiaozhazi 项目源码 文件源码
def tar_file():
#create file path.
    file_path = '/tmp/' + image_name

    if False == os.path.exists(file_path):
        print 'Error, file dir %s not exist'% file_path

    full_name = '/tmp/'+image_name+'.tar'
    tar_file = tarfile.open(full_name,'w')
    for root,dirs,files in os.walk(file_path):
        for file in files:
            fullpath = os.path.join(root,file)
            tar_file.add(fullpath,arcname = file)

    tar_file.close()


    if False == os.path.isfile(full_name):
        print 'Error, tar failed'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号