これが私が達成しようとしているものです
def fun():
runner = InteractiveConsole()
while(True):
code = raw_input()
code.rstrip('\n')
# I want to achieve the following
# By default the output and error of the 'code' is sent to STDOUT and STDERR
# I want to obtain the output in two variables out and err
out,err = runner.push(code)
これまで見てきたすべてのソリューションでは、いずれかのパイプを使用して個別のスクリプト実行コマンドを発行します (私の場合は不可能です)。これを達成できる他の方法はありますか?