python if条件判断

判断目录是否存在,如果不存在就创建多级目录

import os
if not os.path.isdir('/ceshi/aa/cc'):
    os.makedirs('/ceshi/aa/cc')

 

posted @ 2018-11-19 11:13  effortsing  阅读(137)  评论(0编辑  收藏  举报