【发布时间】:2012-01-13 16:41:57
【问题描述】:
我需要在 Python 中保存输出。
示例:
import os
ob_start();
os.system( 'c:\files\file.exe' );
var = ob_content();
ob_close();
print "message:\n\t" + var
【问题讨论】:
-
你的意思是file.exe的输出吗?那么可能 subprocess 可以提供帮助:docs.python.org/library/subprocess.html
-
Python 中每行后无需使用分号 (
;)
标签: python python-3.x controls buffer