import os
filePath = 'D:\12345'
# 判断文件夹是否存在,不存在则创建文件夹if not os.path.exists(filePath): os.makedirs(filePath)