I have a series of fields to check for a certain value, then calculate other fields with using UpdateCursor.
Fields are: SPECIES_CD_1, SPECIES_CD_2, etc.. up to SPECIES_CD_99
Here is the general idea (some pseudocode in here):
rows = arcpy.UpdateCursor(FC) speciesLevel = "SPECIES_CD_" for x in range (2,99): speciesX = speciesLevel + str(x) #this is a string speciesUnicode = speciesX.decode #Decodes the speciesX string to Unicode for row in rows: if row.speciesUnicode == 'P%': [do a whole bunch of things] elif row.speciesUnicode == None: [do other things] else: [do other things]
Of course the cursor cannot identify a row named speciesUnicode, so the cursor fails to run. I want speciesUnicode to act as a variable that subs in a field name. Is this possible somehow?