jlaroussi

How to access just one specific value in a row

Discussion created by jlaroussi on Mar 27, 2014
Latest reply on Mar 28, 2014 by FLBB
I am looking for a way to compare  values in my fieldA. Specifically I would like to compare my last value to the one in the row above. I used GetCount to know how many rows I have. So for example if GetCount returns that there is 10 rows, I would like to compare numeric values from row 10 and 9 in a fieldA. For some reason I have problem with accessing values with a specific index: I can access all values but not just one. I tried to modify code from http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001q000000

with arcpy.da.SearchCursor(fc, ['fieldA',]) as cursor:
    for row in cursor:
        print(row)

to something like

with arcpy.da.SearchCursor(fc, ['fieldA',]) as cursor:
    for row in cursor:
        myValue=row[10]
print (myValue)

but it does not work.
Did anybody figured out how to access just one specific value, not all of them?

Outcomes