Riverside

Python Doc Correction

Discussion created by Riverside on May 21, 2012
Latest reply on May 21, 2012 by dwynne-esristaff
From http://resourcesbeta.arcgis.com/en/help/main/10.1/index.html#/SearchCursor/018w00000011000000/

[h=2]Code Sample[/h]SearchCursor example 1Use SearchCursor to step through a feature class, printing specific field values and the x,y coordinates of the point.





import arcpy  
fc = "c:/data/base.gdb/well" 
fields ["WELL_ID", "WELL_TYPE", "SHAPE@XY"]  
# For each row print the WELL_ID and WELL_TYPE fields, and the 
#  the feature's x,y coordinates # 
with arcpy.da.SearchCursor(fc, fields) as cursor:     
  for row in cursor:         
    print("{0}, {1}, {2}".format(row[0], row[1], row[2]))


There needs to be an = sign for fields above.
fields = ["WELL_ID", "WELL_TYPE", "SHAPE@XY"]

Outcomes