python如果文件夹存在,则清空,目录文件夹不存在则创建
import shutil
import os
dirs = "masked_frames"
if not os.path.exists(dirs):
os.makedirs(dirs)
else:
shutil.rmtree(dirs)
os.makedirs(dirs)
python如果文件夹存在,则清空,目录文件夹不存在则创建
import shutil
import os
dirs = "masked_frames"
if not os.path.exists(dirs):
os.makedirs(dirs)
else:
shutil.rmtree(dirs)
os.makedirs(dirs)