Numpy-like printing for python objects
<p>While doing data analysis in Ipython I often have to look at the data by just printing its contents to the shell. Numpy have the facility to show only the <strong>margins</strong> of huge objects when they are too long themselves. I really like this feature of ndarrays but when I print internal python object (eg. dictionary with 15k objects in it) they are dumped to the screen or sometimes truncated in not very friendly fashion. 
So for example for a huge dictionary I would like to see in output something like  this  </p>

<pre><code>{ '39416' : '1397',  
  '39414' : '1397',  
  '7629'  : '7227',  
  ...,  
  '31058' : '9606',  
  '21097' : '4062',  
  '32040' : '9606' }  
</code></pre>

<p>It would be perfect if alignment and nested data structures could be taken care of. Is their a special module which can provide such functionality for python basic classes (list, dict)? Or there are some ipython configuration tricks I know nothing about?</p>

<p>If your dictionary is well structured, you could convert it to a Pandas dataframe for viewing.</p>

<pre><code>import numpy as np
import pandas as pd

&gt;&gt;&gt; pd.DataFrame({'random normal': np.random.randn(1000), 
                  'random int': np.random.randint(0, 10, 1000)})
     random int  random normal
0             6       0.850827
1             7       0.486551
2             4      -0.111008
3             9      -1.319320
4             6      -0.393774
5             1      -0.878507
..          ...            ...
995           2      -1.882813
996           3      -0.121003
997           3       0.155835
998           5       0.920318
999           2       0.216229

[1000 rows x 2 columns]
</code></pre>

python printing ipython