如何使用Python3打开多个fifo? 下面的代码非常简单,但是它在最后一行堆叠并等待(?)... 请帮忙吗?
toAgent = ['ABCD', 'EFGH', 'IJKL', 'MNOP',]
def createPipe():
for i in range(0, len(toAgent)):
#print(i)
fifoName = '../tmp/' + toAgent[i]
if not os.path.exists(fifoName):
os.mkfifo(fifoName)
pipeName = 'pipe_' + str(i)
print(pipeName, fifoName)
pipeName = os.open(fifoName, os.O_WRONLY )
答案 0 :(得分:0)
import os
toAgent = ['ABCD', 'EFGH', 'IJKL', 'MNOP',]
def createPipe():
for i in range(0, len(toAgent)):
#print(i)
fifoName = '../tmp/' + toAgent[i]
if not os.path.exists(fifoName):
os.mkfifo(fifoName)
pipeName = 'pipe_' + str(i)
print(pipeName, fifoName)
pipeName = os.open(fifoName, os.O_WRONLY )
createPipe()