当前位置:主页 > 软件编程 > Python代码 >

python 判断文件还是文件夹的简单实例

时间:2021-06-03 09:10:10 | 栏目:Python代码 | 点击:

如下所示:

import os
if os.path.isdir(path):
  print "it's a directory"
elif os.path.isfile(path):
  print "it's a normal file"
else:
  print "it's a special file(socket,FIFO,device file)"

您可能感兴趣的文章:

相关文章