Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import arcpy
- feature_class = 'C:data.gdbfeatures123' #Change
- field_to_update = 'somefield' #Change
- values = [1,2,3,4] #Change
- list_iterator = iter(values)
- with arcpy.da.UpdateCursor(feature_class, field_to_update) as cursor:
- for row in cursor:
- try:
- row[0] = next(list_iterator) #Assign list value to row[0]/field_to_update
- cursor.updateRow(row) #Update the field
- except StopIteration: #If you have less items in list than number of rows in feature class
- print 'List is empty, cant update any more rows'
Add Comment
Please, Sign In to add comment