Check if file is a named pipe (fifo) in python?

前端 未结 1 601
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-17 08:57

I communicate with a named pipe, but I would like to check if it really is a named pipe BEFORE opening it.

I check in Google but there is nothing, os.path.isfi

相关标签:
1条回答
  • 2020-12-17 09:42

    You can try:

     import stat, os
    
     stat.S_ISFIFO(os.stat(path).st_mode)
    

    docs

    0 讨论(0)
提交回复
热议问题