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