paging in python shell

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Jan 21 01:22:31 EST 2008


En Mon, 14 Jan 2008 21:05:38 -0200, Ben Finney  
<bignose+hates-spam at benfinney.id.au> escribi�:

> To my knowledge there's nothing in the default Python shell that
> enables what the OP is asking for. There are other Python shells, e.g.
> Idle, ipython, or a Python window inside Emacs, that may be better
> suited.

Yes, there is. Thanks to Tim Roberts who menctioned that the builtin help  
system implements paging internally, I looked at it. It's easy to use (but  
maybe too late for the OP):

Let Python determine the best pager available:

import pydoc
pydoc.pager(text)

(it may pipe the text into an external program like less or more). Or  
explicitely use the builtin pager:

import pydoc
pydoc.ttypager(text)


-- 
Gabriel Genellina




More information about the Python-list mailing list