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.
Look at the code for
pydoc, i.e.:(This is for Windows, of course everywhere else the slashes go the other way.)
Helper class’s
helpmember function callsdocfunction callsrender_doc, which is probably the function you want.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: