例如,在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中执行此操作吗?
慕姐4208626
三国纷争
随时随地看视频慕课网APP
相关分类