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
Ingelogde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Maak gratis een account aan.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.