Printing long lines in PythonWin (was Re: Big bug with PythonWin)

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue May 8 11:13:53 CEST 2001


Carlos Ribeiro <cribeiro at mail.inet.com.br> wrote in
<mailman.989201290.6439.python-list at python.org>: 

> I'm getting used to a little hack:
> 
> >>> import pprint
> >>> p = pprint.pprint   # shorthand from pretty printer
> 
> For example,
> 
> >>> p(globals())
> {'__builtins__': <module '__builtin__' (built-in)>,
>   '__doc__': None,
>   '__name__': '__main__',
>   'p': <function pprint at 014DDEFC>,
>   'pprint': <module 'pprint' from 'f:\python21\lib\pprint.pyc'>,
>   'pywin': <module 'pywin' from
>   'f:\python21\pythonwin\pywin\__init__.pyc'>} 
> 
> 
> It makes easy to get nicely formatted output.
> 
> 
don't forget in Python 2.1 you can do:
>>> import sys, pprint
>>> sys.displayhook = pprint.pprint
>>> globals()
{'__builtins__': <module '__builtin__' (built-in)>,
 '__doc__': None,
 '__name__': '__main__',
 'pprint': <module 'pprint' from 'd:\python21\lib\pprint.pyc'>,
 'sys': <module 'sys' (built-in)>}


-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list