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