Create a temporary FIFO (named pipe) in Python?

后端 未结 6 1291
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 05:49

How can you create a temporary FIFO (named pipe) in Python? This should work:

import tempfile

temp_file_name = mktemp()
os.mkfifo(temp_file_name)
open(temp_         


        
6条回答
  •  [愿得一人]
    2020-11-29 06:21

    If it's for use within your program, and not with any externals, have a look at the Queue module. As an added benefit, python queues are thread-safe.

提交回复
热议问题