Title says it all. I'd prefer that Python's shell use cat
instead of less
when displaying help so that the contents of help is inline with the rest of the shell session.
The help()
function seems to respect the PAGER
environment variable. So the following works for me to switch to cat
as the pager instead of less
:
PAGER=cat python
>>> import os
>>> help(os)
You can also change the environment variable from inside Python:
>>> import os
>>> os.environ['PAGER'] = 'cat'
>>>
>>> help(os)
But note that this will only have an effect if you do this before the first time you use the pager, because the pager is cached in pydoc.py
after the first time it has been determined.
This also seems to work:
>>> import pydoc
>>> pydoc.pager = pydoc.plainpager
This works even if you have already invoked the help command, as it replaces the cached version in pydoc.py.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With