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

 

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

posted @ 2019-08-22 18:20  anobscureretreat  阅读(8645)  评论(0)    收藏  举报