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

Carlos Ribeiro cribeiro at mail.inet.com.br
Sun May 6 22:09:32 EDT 2001


At 01:32 07/05/01 +0000, Sheila King wrote:
>It would also be nice if extra-long lines wrapped in the interactive
>mode (when printing out a list, for example). When I'm playing with
>stuff, let's say I print out a directory listing of files in the current
>working directory, it is one long line that goes way off the viewable
>IDE screen.

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.


Carlos Ribeiro






More information about the Python-list mailing list