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

来源:互联网 发布:c 编程培训机构 编辑:程序博客网 时间:2024/04/25 21:39
>>> 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
原创粉丝点击