AnsweredAssumed Answered

How can i change the layer label in TOC with py ?

Question asked by rfoscarini on Mar 15, 2017
Latest reply on Jul 5, 2018 by bixb0012

I want to change this information, with python:



I have this code (got here: rename layers displayed on TOC ) , but it changes the layer name. I want to change layer label.

It is a simple feature, with no unique values.



import arcpy, os
from arcpy import env 
env.workspace = os.curdir

for mxdFile in arcpy.ListFiles("*.mxd"): 
    mxdPath = env.workspace + "\\" + mxdFile 
    mxd = arcpy.mapping.MapDocument(mxdPath)   
    layers = arcpy.mapping.ListLayers(mxd)   
    for lyr in layers:   
        if == "old name":
   = "newname"