import arcpy fc = "C:/Users/hchapa.LRGVDC911.000/Documents/ArcGIS/Default.gdb/Test_Shapefile_SpatialJoin" field = "parcel_1" fc2 = "C:/GIS_DATA/Test_Shapefile.shp" field2 = "parcel" value = [] cursor = arcpy.SearchCursor(fc) UpdateCursor = arcpy.UpdateCursor(fc2) for row in cursor: value = row.getValue(field) for row2 in UpdateCursor: row2.setValue(field2, value) UpdateCursor.updateRow(row2) print "Done"
Solved! Go to Solution.
import arcpy fc = "C:/Users/hchapa.LRGVDC911.000/Documents/ArcGIS/Default.gdb/Test_Shapefile_SpatialJoin" field = "parcel_1" fc2 = "C:/GIS_DATA/Test_Shapefile.shp" field2 = "parcel" value = [] #You should remove this line. It's not needed. cursor = arcpy.SearchCursor(fc) UpdateCursor = arcpy.UpdateCursor(fc2) # fetch the 1st row, for both search/update cursors row = cursor.next() row2 = UpdateCursor.next() while row: if row.shape.touches(row2.shape): row2.setValue(field2, row.getValue(field)) UpdateCursor.updateRow(row2) # advance both cursors to next row obj row = cursor.next() row2 = UpdateCursor.next() del cursor, UpdateCursor print "Done"