Python保持命名管道打开

2024-05-19 13:09:02 发布

您现在位置:Python中文网/ 问答频道 /正文

在bash中,命名管道可以用cat > mypipe保持打开状态。在python中如何做到这一点?到目前为止,我得到的是:

import subprocess
import os

if not os.path.exists("/tmp/mypipe"):
    os.mkfifo("/tmp/mypipe")

Tags: pathimportbashif管道os状态exists