AnsweredAssumed Answered

Compare value from n and n+1 row in searchCursor

Question asked by soldous on Jul 27, 2016
Latest reply on Jul 28, 2016 by bixb0012

Hello,

 

I have a searchCursor that goes through a specific column in a table. On every row I need to compare the value from this row with the value on the next row and if they are equal do something and if they aren't equal do something else.

 

 

 

mxd = arcpy.mapping.MapDocument("CURRENT")  
table = arcpy.mapping.ListTableViews(mxd)[0]  
column = "name"  
cursor=arcpy.SearchCursor(table)  
for row in cursor:  
    print(row.getValue(column))  

 

I have this sample of code. It goes through all rows. But how can I compare the value from row[row] with the value from row[row+1]??

 

Thanks for any help.

Outcomes