首页 > 编程语言 >python gz解压

python gz解压

时间:2023-02-16 11:35:53浏览次数:32  
标签:解压 python gz file new path data

def decompose_file(data):
    # ungz_file_path = gz_file_path.replace(".gz", "")
    # with gzip.open(gz_file_path, 'rb') as f_in:
    #     with open(ungz_file_path, 'wb') as f_out:
    #         shutil.copyfileobj(f_in, f_out)
    new_data = gzip.decompress(data)
    return new_data

其中data是源文件的buffer,new_data是解压之后的新文件的buffer,直接操作就行了。

标签:解压,python,gz,file,new,path,data
From: https://www.cnblogs.com/c-x-a/p/17126072.html

相关文章