How to disable Python shell less than "help"

The name says it all. I would prefer the Python shell to use cat instead of the smaller size when displaying help, so that the contents of the help are embedded in the rest of the shell session.

Thanks.

+7
python shell
source share
2 answers

The help() function seems to apply to the PAGER environment variable . So, for me, switch to cat as a pager instead of less :

 PAGER=cat python 
 >>> import os >>> help(os) 

You can also change the environment variable from within Python:

 >>> import os >>> os.environ['PAGER'] = 'cat' >>> >>> help(os) 

But note that this will have an effect if you do this before you use the pager for the first time, because the pager is cached in pydoc.py after the first definition.

+7
source share

This also works:

 >>> import pydoc >>> pydoc.pager = pydoc.plainpager 

This works even if you already called the help command, as it replaces the cached version in pydoc.py.

+4
source share

All Articles