import arcpy from arcpy import env env.workspace = r"C:\temp\python\test.gdb" fc = "featureClass" with arcpy.da.UpdateCursor(fc, ["field1", "field2"]) as cursor: for row in cursor: if row[0] == 1: row[1] = 'Woodland' if row[0] == 2: row[1] = 'Arable' ...... ..... cursor.updateRow(row) del cursor, row
Hi Mark,Here is an example on how to do this using the arcpy.da.UpdateCursor (10.1 or beyond is required):import arcpy from arcpy import env env.workspace = r"C:\temp\python\test.gdb" fc = "featureClass" with arcpy.da.UpdateCursor(fc, ["field1", "field2"]) as cursor: for row in cursor: if row[0] == 1: row[1] = 'Woodland' if row[0] == 2: row[1] = 'Arable' ...... ..... cursor.updateRow(row) del cursor, row
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.