【参考】
【实践】
# -*- coding:utf-8 -*- import os # 读取目录下文件列表 v_foleder=‘D:/aaa1/bbb1/hug‘ Vname_list=os.listdir(v_foleder) print Vname_list # 指定路径创建新文件夹 v_name=‘ccc_hug‘ folder_name=‘img_‘+v_name file_path=‘D:/aaa1/bbb1/‘+folder_name if not os.path.exists(file_path): # 判断文件夹是否已经存在 os.mkdir(file_path) print file_path + ‘ 创建成功‘ else: print file_path + ‘ 目录已存在‘
【其他/补充】
原文:https://www.cnblogs.com/anno-ymy/p/10728230.html