Hi
I am still relatively new to Python and have trouble understanding lines/parts of certain scripts. I am interested in developing a tool that can turn certain layers off and would appreciate a little help understanding a script I found on another forum.
In the script shown below I can understand most sections apart from lines 5 and 6. I don't really get what the [0] stands for or is referring to, I do not know what the "*" is for, and more importantly I don't fully understand how these two lines interact with the rest of the script.
I would appreciate any guidance anyone can provide.
Regards,
Geord359
I am still relatively new to Python and have trouble understanding lines/parts of certain scripts. I am interested in developing a tool that can turn certain layers off and would appreciate a little help understanding a script I found on another forum.
In the script shown below I can understand most sections apart from lines 5 and 6. I don't really get what the [0] stands for or is referring to, I do not know what the "*" is for, and more importantly I don't fully understand how these two lines interact with the rest of the script.
Code:
names = [x,y,z,etc]
mxd = arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(, mxd, "Layers")[0]
layers = arcpy.mapping.ListLayers(mxd, "*", df)
for layer in layers:
if layer.name in names:
layer.visible = False
arcpy.RefreshTOC()
arcpy.RefreshActiveView()Regards,
Geord359