# coding=utf-8import glob
import shutil
import os
defPicPath(path):if os.path.exists(path):print(path," is exists!")ifnot os.listdir(path):print(path," is empty!")else:print(path," is not empty ")
shutil.rmtree(path,True)print("old path delete successfully")
os.makedirs(path)print("new image path is Recreated successfully!")else:print(path," is not exists!")
os.makedirs(path)print("new image path is created successfully!")
1. 创建新文件夹若存在且不为空,删除旧文件夹,重新创建# coding=utf-8import globimport shutilimport osdef PicPath(path): if os.path.exists(path): print(path, " is exists!") if not os.listdir(path): print(path, " is empty!") else: