python判断文件和文件夹是否存在、创建文件夹

来源:互联网 发布:系统软件和软件系统 编辑:程序博客网 时间:2024/04/30 05:49
>>> import os
>>> os.path.exists('d:/assist')
True
>>> os.path.exists('d:/assist/getTeacherList.py')
True
>>> os.path.isfile('d:/assist')
False
>>> os.path.isfile('d:/assist/getTeacherList.py')
True
>>> os.makedirs('d:/assist/set')
>>> os.path.exists('d:/assist/set')
True
0 0