热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

检查文件是否是python中的命名管道(fifo)?-Checkiffileisanamedpipe(fifo)inpython?

Icommunicatewithanamedpipe,butIwouldliketocheckifitreallyisanamedpipeBEFOREopeni

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.isfile() returns False, and I really need to check it.

我在谷歌检查但没有任何东西,os.path.isfile()返回False,我真的需要检查它。

1 个解决方案

#1


26  

You can try:

你可以试试:

 import stat, os

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

docs

文档


推荐阅读
author-avatar
心平
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有