Commit e34c3104 by 岳巧源

add ungz function

parent 026b61e1
Showing with 8 additions and 0 deletions
import gzip
import zipfile
......@@ -12,3 +13,10 @@ def unzip(zip_path, save_path):
print('the unzipping process is over...')
f.close()
def ungz(file_path: str):
"""unzip the file like *.gz """
new_file_name = file_path.replace(".gz", "")
g_file = gzip.GzipFile(file_path)
open(new_file_name, "wb+").write(g_file.read())
g_file.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment