Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ドキュメントを検索して検索しましたが、 StringIO オブジェクトのブロックについては何も言われていません。
StringIO をラップするだけの独自のファイルのようなオブジェクトを作成できますが、それをブロックする最良の方法は何ですか? 私が知っている唯一の方法は、データが利用可能になるまで while ループと time.sleep(0.1) を使用することです。
import os r, w = os.pipe() r, w = os.fdopen(r, 'rb'), os.fdopen(w, 'wb')
必要に応じて正確に動作します。残念ながら、このパイプ関数はドキュメントではあまり明白ではないため、後で見つけました。