判断是文件夹还是文件
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)"
判断文件是否存在
import os
os.path.exists('d:/assist')
os.path.exists('d:/assist/getTeacherList.py')
获取文件大小
import os
os.path.getsize(path)