Warm tip: This article is reproduced from stackoverflow.com, please click
file-conversion gzip MNIST neural-network python

How to covert a file to .gz extension

发布于 2021-01-28 04:06:14

I am working with MNIST data in ML(for digit recognistion) and I want to convert my 'mnist.pkl' to 'mnist.pkl.gz' because the turtorial I am watching uses that extension.This is the file he uses

also if possible please tell me what are those ..... that he has before the file name('.../data/mnist.pkl.gz', 'rb') if you are familiar with it Thank You

Questioner
D Star Let's Explore
Viewed
0
Simon Fromme 2020-10-06 09:58

The extension .gz indicates that the file was compressed using gzip which you can do by invoking

gzip mnist.pkl

on the command line. The command will remove the original file and replace it with a compressed version named mnist.pkl.gz.

That said, you don't have to compress/decompress the file in your particular case. Just use

f = open('../data.mnist.pkl', 'rb')

instead of

f = gzip.open('../data.mnist.pkl.gz', 'rb')