My ArcMap verison is 10.2.
My goal is to print the name of each layer in a mxd using Arcpy.
My script is below. There is no error, but it prints the first layer multiple times instead of all the layers in the "Main Map" data frame.
Does anyone have a solution?
import arcpy
mxd = arcpy.mapping.MapDocument(r"O:\Solar Databases\MO_projects.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Main Map")[0]
for lyr in df:
x = 0
name = arcpy.mapping.ListLayers(mxd, "", df)[x].name
print name
x = x+1
del mxd