Hi all,
I am wondering how to get the value a field frorm the first row without looping through all the rows?
Thanks
Several functionally equivalent code snippets were provided. I doubt the performance differences between the different code snippets will be noticeable, let alone significant. I think it is mostly a matter of style and what you prefer.
Lately, if I don't need to re-use the cursor, I have been using a variation of the one liner offered by Xander Bakker:
import arcpy
fc = 'c:/data/base.gdb/features'
values = next(arcpy.da.SearchCursor(fc, ['OID@', 'SHAPE@AREA']))