Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

How to access just one specific value in a row

$
0
0
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/...0000001q000000

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?

Viewing all articles
Browse latest Browse all 2485

Trending Articles