AnsweredAssumed Answered

Print Out And Change Layer Labels With ArcPy

Question asked by lloydbronn on May 16, 2017
Latest reply on May 16, 2017 by lloydbronn

I need to change the way my labels are displayed in ArcMap using ArcPy. I want to replace underscores with spaces in label strings with using string.replace("_"," "). I have SHOWLABELS set to True, but I'm having trouble accessing the label values themselves in ArcPy. Looking in the LabelClass documentation, I can't find any method to print out or alter the label values. 


city_layer = arcpy.mapping.ListLayers(mxd, "cities")[0]
countries_layer = arcpy.mapping.ListLayers(mxd, "countries")[0]
    if city_layer.supports("SHOWLABELS"):
        city_layer.showLabels = True

    if countries_layer.supports("SHOWLABELS"):
        countries_layer.showLabels = True