This question already has an answer here:
I’m new to ArcMap and was wondering if anybody could help me out. I have a shapefile with counties and wells in that county. In the table I’m trying edit it so that for each county calculate the total numbers of wells that fall into that county, and update the county table with the total count. I also want to calculate how many wells there are per area unit, and update the table with that value as well.
import arcpy featureClass = "C:/Lesson5_Data/Colorado_cities.shp" fieldList = "*" with arcpy.da.SearchCursor(featureClass, fieldList) as cursor: for row in cursor: print row[4 population = 10000 whereClause = '"POP2007" >= ' + str(population