Question: in python interactive shell, if you do

```
>>> import os
>>> help(os)

```

you will get a `linux` `man`-like help page. anybody has ideas how to do it in pure python? Now I have implemented a similar shell by `raw_input` and python `readline` module. But I totally have no idea how to do the help page.

thanks.

Answer: 
Look at the code for `pydoc`, i.e.:

```
    Python27\Lib\pydoc.py

```

(This is for Windows, of course everywhere else the slashes go the other way.)

Helper class's `help` member function calls `doc` function calls `render_doc`, which is probably the function you want.

```
import sys
import pydoc

plainSysDoc = pydoc.plain((pydoc.render_doc(sys)))
print plainSysDoc

```

pydoc.plain is a formatting function (that removes bold formatting).

As a side note, while fact checking this answer I learned that pydoc can be called from the command line:

```
pydoc sys

```
OK, I got an easy way. just call 'man' by subprocess and make my help documents to man page separately