在 2012年12月21日星期五UTC+8下午3时24分10秒,Chris Angelico写道:
On Fri, Dec 21, 2012 at 4:23 PM, iMath redstone-c...@163.com wrote:
redirect standard output problem
why the result only print A but leave out 888 ?
No idea, because when I paste your code into the Python 3.3
interpreter
On Sun, Dec 23, 2012 at 2:07 AM, iMath redstone-c...@163.com wrote:
when I run it through command line ,it works ok ,but when I run it through
IDLE , only print A but leave out 888
so why ?
Because IDLE has to fiddle with stdin/stdout a bit to function. Try
adopting Dave's recommendation -
On 12/22/2012 10:15 AM, Chris Angelico wrote:
On Sun, Dec 23, 2012 at 2:07 AM, iMath redstone-c...@163.com wrote:
when I run it through command line ,it works ok ,but when I run it through IDLE
, only print A but leave out 888
so why ?
Because IDLE has to fiddle with stdin/stdout a bit to
On 21/12/12 06:23:18, iMath wrote:
redirect standard output problem
why the result only print A but leave out 888 ?
import sys
class RedirectStdoutTo:
def __init__(self, out_new):
self.out_new = out_new
def __enter__(self):
sys.stdout = self.out_new
def
On 12/21/2012 12:23 AM, iMath wrote:
redirect standard output problem
why the result only print A but leave out 888 ?
import sys
class RedirectStdoutTo:
def __init__(self, out_new):
self.out_new = out_new
def __enter__(self):
sys.stdout = self.out_new
def
redirect standard output problem
why the result only print A but leave out 888 ?
import sys
class RedirectStdoutTo:
def __init__(self, out_new):
self.out_new = out_new
def __enter__(self):
sys.stdout = self.out_new
def __exit__(self, *args):
sys.stdout = sys
On Fri, Dec 21, 2012 at 4:23 PM, iMath redstone-c...@163.com wrote:
redirect standard output problem
why the result only print A but leave out 888 ?
No idea, because when I paste your code into the Python 3.3
interpreter or save it to a file and run it, it does exactly what I
would expect