Python arcpy 删除临时tif文件及文件夹

# 删除临时文件
    filelist = []
    filelist = os.listdir(tempPath)
    for f in filelist:
        filepath = os.path.join(tempPath, f)
        if os.path.isfile(filepath):
            # os.remove(filepath)
            arcpy.Delete_management(filepath)
            print filepath + "removed!"
        elif os.path.isdir(filepath):
            shutil.rmtree(filepath, True)
            print "dir" + filepath + "removed!"
    os.rmdir(tempPath)

 

转载自:https://blog.csdn.net/qq_27690839/article/details/86639349

You may also like...