wasm-demo/demo/ermis-f/python_m/cur/0355

33 lines
712 B
Plaintext

From: stephan at pcrm.win.tue.nl (Stephan Houben)
Date: 27 Apr 1999 08:28:25 +0200
Subject: To redirect stdin,out
References: <37248549.6AD365AC@pk.highway.ne.jp>
Message-ID: <m3btga37cm.fsf@pcrm.win.tue.nl>
X-UID: 355
Thooney Millennier <thooney at pk.highway.ne.jp> writes:
>
> import sys
> sys.stdout = StdoutCatcher()
> print 'foo'
>
> I am at a loss how to redirect standard input.
> If you know any solutions,Please Help!
Well, I tried the obvious analog of this code snippet:
import sys
sys.stdin = open("one_of_my_files.txt")
print raw_input()
And it seemded to work fine. Am I missing something?
Greetings,
Stephan