old=sys.stdout with open('test','w') as oFile: sys.stdout=oFile hi() sys.stdout=old with open('test','r') as oFile:if'hello world'+'\n'==oFile.readline():print('PASS')else:print('FAIL',file=sys.stderr) 结果也输出了PASS C:\Users\suneee\AppData\Local\Programs\Python\Pytho...