2012-12-27 80 views
0

我使用Python的標準輸入到recv的消息從其它工藝如何更改python的stdin緩衝區大小?

,但要改變快速的recv消息的標準輸入緩衝區大小

我知道subprocee可以設置標準輸入BUFF時,打開一個子進程

但我的一個過程是AC過程whice發送消息

另一個是蟒蛇的過程,recv的消息

我怎樣才能改變標準輸入緩衝區大小在蟒蛇?

我的主機是一臺Linux機器..

+17

這是一首美麗的詩。 – jdi

+4

@jdi感謝您的好笑! – DhruvPathak

回答

0

an answer to a similar question

您可以從標準輸入/徹底刪除緩存使用python的-u標誌標準輸出:

-u  : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x) 
     see man page for details on internal buffering relating to '-u' 

和man page澄清:

-u  Force stdin, stdout and stderr to be totally unbuffered. On 
     systems where it matters, also put stdin, stdout and stderr in 
     binary mode. Note that there is internal buffering in xread- 
     lines(), readlines() and file-object iterators ("for line in 
     sys.stdin") which is not influenced by this option. To work 
     around this, you will want to use "sys.stdin.readline()" inside 
     a "while 1:" loop. 

除此之外,它沒有(很好或廣泛)支持。

+6

如果你只是從另一個答案中挑剔,那麼正確的做法是將問題標記爲重複。 – 2015-10-16 12:41:27

+0

對不起,我找不到按鈕。 – criptych