【发布时间】:2013-07-29 18:06:57
【问题描述】:
我有一个函数:
def hello_world(output):
output.write("Hello World")
并想将这些传递给它:
file = io.open("myfile.txt", "w")
hello_world(file)
hello_world(sys.stdout)
我不知道这样是否正确。我也得到NameError: global name 'sys' is not defined
你会怎么做我想做的事?
【问题讨论】: