today , Do machine learning , When decompressing the dataset , Reference boss Cluck duck Of article The way to think of it .
The code is as follows :
import sys
import gzip
import os
def process_dataset(path):
# path = 'G:/DeepLearning/data/'
if os.path.exists(path):
# os.system('cd G:/DeepLearning/data/')
# path = os.getcwd()
dirs = os.listdir(path)
# print(dirs)
for dir in dirs:
if '.gz' in dir:
# print(dir)
filename = dir.replace(".gz","")
gzip_file = gzip.GzipFile(path+dir)
# print(gzip_file)
# print(filename)
with open(path+filename,'wb+') as f:
f.write(gzip_file.read())
if __name__ == '__main__':
process_dataset(path='G:/DeepLearning/data/')
Running results :
Last , Thank you for coming to watch my article , There may be many inadequacies in the text , I also hope to point out and sea culvert .
The whole project includes: op
explain : This is a practical