Another option is to temporarily redirect the standard-output into a
string-buffer object:

import sys
from cStringIO import StringIO

def getHelp(obj):
    stdout = sys.stdout
    try:
        sys.stdout = StringIO()
        help(obj)
        doc = sys.stdout.getvalue()
    finally:
        sys.stdout = stdout
    return doc


- Ofer
www.mrbroken.com


On Mon, Feb 1, 2010 at 9:46 PM, ryant <[email protected]> wrote:

> I used several of the pydoc functions but did not get what I was
> looking for.
>
> import pydoc
> import math
>
> helpTxt = pydoc.getdoc(math)
>
> # only returns the following:
> This module is always available.  It provides access to the
> mathematical functions defined by the C standard.
>
> helpTxt = pydoc.doc(math)
>
> # prints the documents that help does but helpTxt prints None
> print helpTxt
> None
>
> Just as I was about to ask for more help I figured out what I wanted:
>
> import pydoc
> import math
> helpTxt = pydoc.render_doc(math)
> helpTxt = pydoc.plain(helpTxt)
> print helpTxt
>
> Ryan
>
>
>
> On Feb 1, 8:46 pm, Chad Dombrova <[email protected]> wrote:
> > hi ryan,
> > the help command uses the pydoc module:
> http://docs.python.org/library/pydoc.html
> >
> > -chad
>
> --
> http://groups.google.com/group/python_inside_maya
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to