Use ArcPy to rename MXD layers

المشرف العام

Administrator
طاقم الإدارة
I have a MXD with some layers that have parentheses in them. I'd like to rename them via script.

Is this a valid approach?

import remap = arcpy.mapping.MapDocument("CURRENT")layers = arcpy.mapping.ListLayers(map)for layer in layers: if re.search("[()]", layer.name): newName = re.sub("[()]", "", layer.name) arcpy.Rename_management(layer, newName)Rename_management is giving me an error:

Runtime error : ERROR 000840: The value is not a Data Element.


أكثر...
 
أعلى