Andriy Tylychko
Andriy Tylychko

Reputation: 16266

python help() function shortcuts

What are shortcuts of Python help() function used in Python interpreter?

I'm interested for help content that doesn't fit to window and shows "-- More --" at the bottom. I found q quits help(). What is a shortcut to show the whole article w/o pressing Enter many times?

Upvotes: 4

Views: 3405

Answers (4)

SearchSpace
SearchSpace

Reputation: 205

Most relevant shortcuts for MS Windows (more):

  • space bar: display next page
  • p with number: display n lines
  • q: quit

For more comprehensive list see link (imo there aren't more interesting shortcuts).

No search available, but one can do e.g. p 99999 and then use e.g. find of vscode for searching the output.

(I'm quite suprised this thread doesn't get more attention since help() is the most important command for exploring python libraries usage)

Upvotes: 0

yak
yak

Reputation: 9041

The help() function in Python interactive interpreter is based on the pydoc module. There's a function called getpager() in this module that decides what to use to display the help depending on various factors.

In most cases it will use the less command on Linux and more on Windows.

Upvotes: 3

Tim Pietzcker
Tim Pietzcker

Reputation: 336178

One shortcut is the space bar - it displays the next page of the help text (instead of the next line like Enter).

Upvotes: 2

MAK
MAK

Reputation: 26586

On my (Linux) machine help seems to be using "less". Press "h" when in help to see a complete list of shortcuts/commands. I'm not sure if this will work on Windows though.

Upvotes: 4

Related Questions