title: Saving a dictionary of numpy arrays in human-readable format
body: <p>This is <em>not</em> a duplicate question. I looked around a lot and found <a href="https://stackoverflow.com/questions/35736823/how-to-save-a-dictionary-of-arrays-to-file-in-numpy">this question</a>, but the <code>savez</code>and <code>pickle</code> utilities render the file unreadable by a human. I want to save it in a <code>.txt</code> file which can be loaded back into a python script. So I wanted to know whether there are some utilities in python which can facilitate this task and keep the written file readable by a human.</p>
  
  <p>The dictionary of numpy arrays contains 2D arrays.  </p>
  
  <p>EDIT:<br>
  According to <a href="https://stackoverflow.com/questions/43404027/saving-a-dictionary-of-numpy-arrays-in-human-readable-format/43404096#43404096">Craig's answer</a>, I tried the following :</p>
  
  <pre><code>import numpy as np 
  
  W = np.arange(10).reshape(2,5)
  b = np.arange(12).reshape(3,4)
  d = {'W':W, 'b':b}
  with open('out.txt', 'w') as outfile:
      outfile.write(repr(d))
  
  f = open('out.txt', 'r')
  d = eval(f.readline())
  
  print(d) 
  </code></pre>
  
  <p>This gave the following error: <code>SyntaxError: unexpected EOF while parsing</code>.<br>
  But the <code>out.txt</code>did contain the dictionary as expected. How can I load it correctly?</p>
  
  <p>EDIT 2:
  Ran into a problem : Craig's answer truncates the array if the size is large. The <code>out.txt</code> shows first few elements, replaces the middle elements by <code>...</code> and shows the last few elements.</p>