I have a pickled object in a file called b1.pkl:
$ ls -lb* -rw-r--r-- 1 fireball staff 64743950 Oct 11 15:32 b1.pkl
Then I run the following python code to load the object and upload it to a new file:
import numpy as np import cPickle as pkl fin = open('b1.pkl', 'r') fout = open('b2.pkl', 'w') x = pkl.load(fin) pkl.dump(x, fout) fin.close() fout.close()
The file created by this code is more than twice as large:
$ ls -lb* -rw-r--r-- 1 fireball staff 64743950 Oct 11 15:32 b1.pkl -rw-r--r-- 1 fireball staff 191763914 Oct 11 15:47 b2.pkl
Can someone explain why the new file is much larger than the original? It must contain exactly the same structure.
source share