【发布时间】:2012-05-06 19:59:51
【问题描述】:
例如,在 Python 中,我可以执行以下操作:
realout = sys.stdout
sys.stdout = StringIO.StringIO()
some_function() # prints to stdout get captured in the StringIO object
result = sys.stdout.getvalue()
sys.stdout = realout
你可以在 Go 中做到这一点吗?
【问题讨论】: