Here's a stab at my first practical ArcPy script.
I want to grab a layer by name (rather than by layer order or by file path) in the current MXD, then loop over it's attributes (with a view to modifying them). However I don't know the syntax of connecting the desired layer to the attribute table
Here's what I've got so far:
import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") needle = "1km_Grid" df = arcpy.mapping.ListDataFrames(mxd) for lyr in arcpy.mapping.ListLayers(mxd, "", df): if lyr.name == needle: # curObj = this layer # pseudo code! columns = ["MID", "Shape"] for row in curObj: print ("column 1 is: %s" % (row))