2024-05-19 13:09:02 发布
网友
在bash中,命名管道可以用cat > mypipe保持打开状态。在python中如何做到这一点?到目前为止,我得到的是:
cat > mypipe
import subprocess import os if not os.path.exists("/tmp/mypipe"): os.mkfifo("/tmp/mypipe")
import os import subprocess path = '/tmp/mypipe' if not os.path.exists(path): os.mkfifo(path) with open(path, 'w') as f: subprocess.call(['cat'], stdout=f)
相关问题 更多 >
编程相关推荐