您好,欢迎访问一九零五行业门户网

python检测是文件还是目录的方法

本文实例讲述了python检测是文件还是目录的方法。分享给大家供大家参考。具体实现方法如下:
import osif os.path.isdir(path): print it's a directoryelif os.path.isfile(path): print it's a normal fileelse: print it's a special file (socket, fifo, device file)
希望本文所述对大家的python程序设计有所帮助。
其它类似信息

推荐信息