【python创建文件夹】python创建文件夹
【参考】
【https://www.cnblogs.com/hushaojun/p/4533241.html】
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
【实践】
# -*- 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 + ' 目录已存在'
【其他/补充】

更多精彩