To print to console and capture in a string stdout/stderr of a subprocess in a portable manner:
from StringIO import StringIO
fout, ferr = StringIO(), StringIO()
exitcode = teed_call(["the", "command"], stdout=fout, stderr=ferr)
stdout = fout.getvalue()
stderr = ferr.getvalue()
where teed_call() is defined in Python subprocess get children's output to file and terminal?
You could use any file-like objects (.write() method).