inFile = "INPUT FEATURE CLASS" selectionLayer = MakeFeatureLayer("inFile") rows = arcpy.SearchCursor(inFile) last = "" #or maybe 0 if the attribute is an integer instead of a string for row in rows: if row.FIELD != last: arcpy.AddMessage("Different") arcpy.SelectLayerByAttribute(selectionLayer, "ADD_TO_SELECTION", "\"FID\" = '%s'" % row.FID) #FID is some unique identifier for each feature #change the where clause to "\"FID\" = %i" if FID is an integer else arcpy.AddMessage("Same") last = row.FIELD arcpy.CopyFeatures(selectionLayer, "OUTPUT FEATURE CLASS")
IdList[] rows = arcpy.SearchCursor("INPUT FEATURE CLASS") for row in rows: IdPlusOne = int(row.FIELD) + int(1) IdList.append(IdPlusOne) del row, rows i = 0 i1 = 1 for Id in IdList: if i1 >= len(IdList): break elif Id == IdList[i1]: arcpy.AddMessage("Same") i+=1 i1+=1 else: arcpy.AddMessage("Different") i+=1 i1+=1
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.