mxd = arcpy.mapping.MapDocument("CURRENT") for lyr in arcpy.mapping.ListLayers(mxd): lyr.description = "some text" lyr.save() del mxd
[...] layer = arcpy.MakeFeatureLayer_management(clippedFC, clippedFCLayer) layer.description = "N/A" arcpy.SaveToLayerFile_management(layer, clippedFCLayer, "RELATIVE") [...]
import arcpy, os from arcpy import env arcpy.env.overwriteOutput = True env.workspace = "<lyr file workspace>" mxd = arcpy.mapping.MapDocument(r"C:\temp\Test.mxd") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] listFiles = arcpy.ListFiles("*.lyr") for file in listFiles: addLayer = arcpy.mapping.Layer(file) arcpy.mapping.AddLayer(df, addLayer) arcpy.RefreshTOC() arcpy.RefreshActiveView() for lyr in arcpy.mapping.ListLayers(mxd): lyr.description = "N/A" lyr.saveACopy(str(lyr)) del mxd os.remove(<'PathToMXD>')
import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Data\GISData\GDG\GrabDataPy\test.mxd") for lyr in arcpy.mapping.ListLayers(mxd): print print lyr.name print lyr.description lyr.description = "some text" mxd.save() del mxd