>>> mxd = arcpy.mapping.MapDocument("Current") >>> tableText = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "TableText")[0] >>> for elm in arcpy.mapping.ListLayoutElements(mxd, wildcard="_clone"): ... elm.delete() ...
Solved! Go to Solution.
mxd = arcpy.mapping.MapDocument("Current") tableText = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "TableText")[0] for elm in arcpy.mapping.ListLayoutElements(mxd, wildcard="*_clone"): print elm.name #just to double check you're actually getting results in the list elm.delete()
What version of ArcGIS are you on (10.0 and under don't have the delete() method)?
mxd = arcpy.mapping.MapDocument("Current") tableText = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "TableText")[0] for elm in arcpy.mapping.ListLayoutElements(mxd, wildcard="*_clone"): print elm.name #just to double check you're actually getting results in the list elm.delete()
Think I figured it out. Wildcard needs a wildcard:mxd = arcpy.mapping.MapDocument("Current") tableText = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "TableText")[0] for elm in arcpy.mapping.ListLayoutElements(mxd, wildcard="*_clone"): print elm.name #just to double check you're actually getting results in the list elm.delete()