def update(): import arcpy list = [] rows = arcpy.SearchCursor(r"C:\data\Parcels") for row in rows: list.append(row.AREA) S = sum(list) del row, rows rows = arcpy.UpdateCursor(r"C:\data\Parcels") for row in rows: row.AREA2 = S val = row.AREA2 del row, rows return val
update()
list = [] lstRasters = arcpy.ListRasters("*") for raster in lstRasters: rows = arcpy.SearchCursor(raster) for row in rows: list.append(row.Area) S = sum(list) arcpy.CalculateField_management(raster, "SUM_Area", S) list = [] del row, rows
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.