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)"

猜你喜欢

转载自blog.csdn.net/ZenG_xiangt/article/details/81869177
今日推荐