Maybe just this:
func = getattr(mod, moduleFunc)
You can also temporarily redirect stdout to a string buffer (StringIO) and
just run the built-in 'help' function:
from cStringIO import StringIO
t = sys.stdout
sys.stdout = h = StringIO()
try:
help(func)
finally:
sys.stdout = t
helpStr = h.getvalue()
- Ofer
www.mrbroken.com
On Tue, Mar 16, 2010 at 12:26 PM, ryant <[email protected]> wrote:
> This only works in Python 2.6 and beyond. Is there a way to do this
> before 2.6?
>
> import pydoc
> moduleName = 'math'
> moduleFunc = 'acos'
> mod = __import__(moduleName)
> func = mod.__dict__[moduleFunc]
> helpStr = pydoc.render_doc(func)
> helpStr = pydoc.plain(helpStr)
> print helpStr
>
> Ryan
> www.rtrowbridge.com/blog
> Character TD
> Naughtydog
>
> --
> http://groups.google.com/group/python_inside_maya
--
http://groups.google.com/group/python_inside_maya
To unsubscribe from this group, send email to
python_inside_maya+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.