AnsweredAssumed Answered

Creating A New Feature Class From List Output

Question asked by hsctab14 on Jan 31, 2012
Latest reply on Jan 31, 2012 by mdenil
I have a bit of python code that compares consecutive row values in a field. If the first feature's field value is 1 and the second feature's field value is 2, it prints "Different." If they are both 1, it prints "Same." I want to take the features that read "Different" and shoot those out to a new feature class. I know there's a way to do this in python, but I can't seem to come up with it. My list script is as follows:

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


So I would just like to have those rows that get listed as "Different" to be exported to a new feature class. Is this doable? Thanks so much for any assistance.


Tommy Burk

Outcomes