Get Python’s help() function stored as string just like console

Get Python’s help() function stored as string just like console

Python’s help function lets you see the help message written for you by the developer. It is particularly useful in IDLE / shell to inspect modules and explore.

Here is a sample shell demo

Now if we want to store that text in a string, if we try x = help(print), we get not a string, but a surprise:

Ugh. How the to get the doctring as a string?

In Enters Pydoc

Pydoc is used to generate documentations

Here is the snippet to store the docstring as a variable

Simple isn’t it?

instead of print, add any module.

Lives in Mauritius, cruising python waters for now.