shutil文件夹复制与删除

cooolr 于 2022-09-16 发布
import os
import shutil

# target_path已存在的话会导致报错,需要先删除
if os.path.exists(target_path):
    shutil.rmtree(target_path)
shutil.copytree(source_path, target_path)