make directory python
# Make directory path (recursive) if it does not exist # If exists then no exception is thrown # Analogous to mkdir -p os.makedirs("<<SOME_PATH>>", exist_ok=True)
python makedir
def mkdir(path): import os path=path.strip() path=path.rstrip("\\") isExists=os.path.exists(path) if not isExists: os.makedirs(path) print path+' 创建成功' return True else: print path+' 目录已存在' return False mkpath="d:\\qttc\\web\\" mkdir(mkpath)