IDLE - Customizing output format

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Sep 26 19:30:35 EDT 2006


At Tuesday 26/9/2006 15:31, Ilias Lazaridis wrote:

> > >Anyways, against my better judgement, I will tell you that you can
> > >customize the
> > >output by replacing sys.displayhook with your own function:
> > >
> > >    http://www.python.org/doc/current/lib/module-sys.html
> > >
> > >  >>> import sys
> > >  >>> def f(obj):
> > >         print '    ' + repr(obj)
> > >  >>> sys.displayhook = f
> >
> > Sometimes I enable a similar approach on my sitecustomize.py, using
> > the pprint module. But I don't *always* like the output format.
>
>Can you please show this approach using "pprint"?

Sure. Put these two lines into your sitecustomize.py:

import sys, pprint
sys.displayhook = pprint.pprint

and see what happens when you eval things inside the interpreter.



Gabriel Genellina
Softlab SRL 


	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list