I want to do something like this in the python interpreter.
myhelp = help(myclass)
but the output goes to stdout. Is it possible to assign it to a variable?
Thanks!
You can capture stdout while help(myclass) runs:
from cStringIO import StringIO
import sys
stdout = sys.stdout
buffer = StringIO()
sys.stdout = buffer
help(myclass)
sys.stdout = stdout
myhelp = buffer.getvalue()
StringIO, you have to import from io -> from io import StringIO
pydoc...import pydoc; myhelp = pydoc.render_doc(myclass)