Removing feature layer using ArcPy script?

The Delete tool should accept the name of a feature layer to remove it from the TOC.

Permanently deletes data from disk. All types of geographic data supported by ArcGIS, as well as toolboxes and workspaces (folders, geodatabases), can be deleted. If the specified item is a workspace, all contained items are also deleted.

and under the Syntax section lists the Data Types that can be deleted as:

Data Element; Graph; Layer; Table View


You can invoke arcpy.mapping.RemoveLayer to remove a layer from the TOC.

Provides the ability to remove a layer within a data frame in a map document (.mxd).


This is what I use to remove layers.

arcpy.mapping.RemoveLayer("DataFrame", "Layer Name")

Or looping:

mxd = arcpy.mapping.MapDocument("CURRENT")
for df in arcpy.mapping.ListDataFrames(mxd):
    for lyr in arcpy.mapping.ListLayers(mxd, "", df):
        arcpy.mapping.RemoveLayer(df, lyr)