5
可能重複:
How to flush output of Python print?
unbuffered stdout in python (as in python -u) from within the programPython的打印函數在調用緩衝區時刷新緩衝區?
我有下面的代碼,以沖洗掉輸出緩衝區。
print 'return 1'
sys.stdout.flush()
我可以設置打印功能,以便它在被調用時自動刷新緩衝區?
嗯,亂了我的鏈接,應該是:[在Python中無緩衝標準輸出](http://stackoverflow.com/questions/881696/unbuffered-stdout-in-python-as-in-python-u-from -within最程序) – eldarerathis 2010-10-09 03:05:31