import arcpy from arcpy import env import string env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST" filter = '' cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter) i = 0 for row in cur: i += 1 row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID cur.updateRow(row)
import arcpy from arcpy import env import string env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST" filter = '' cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter) i = 0 for row in cur: i += 1 row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID cur.updateRow(row)
I think your indentation might be offimport arcpy from arcpy import env import string env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST" filter = '' cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter) i = 0 for row in cur: i += 1 row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID cur.updateRow(row)
import arcpy from arcpy import env import string env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST" filter = '' cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter) for i, row in enumerate(cur): row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID cur.updateRow(row)
Christina,
Did you have success with your script? I'm in need of exactly the same thing: a script to auto-generate unique IDs that are a letter+number combo. If so, would you mind sharing your code and/or lessons learned?
peter[dot]palacios[at]yahoo[dot]com
Thanks in advance for your time and courtesy.