Maybe there will be someone from the Arcpy team at SERUG this year I can bug about it . It was obviously a deliberate choice to make such a big change. Ill use your method for now Chris. tuple.index is a good solution.
updateRow[updateRows.fields.index("FIELD_NAME")])
updateRows = arcpy.da.UpdateCursor(myTable,["*"]) for updateRow in updateRows: updateRow[updateRows.fields.index("BASIN_NAME")] = "Basin "+ str(updateRow[updateRows.fields.index("BASIN_ID")])
def rows_as_dicts(cursor): colnames = cursor.fields uc = hasattr(cursor, 'updateRow') for row in cursor: row_object = dict(zip(colnames, row)) yield row_object if uc: cursor.updateRow([row_object[colname] for colname in colnames])
with arcpy.da.SearchCursor(fc, ['*']) as sc: for row in rows_as_dicts(sc): x = row['MAPNAME'] blah ...
fields={field : index for index,field in enumerate(cursor.fields)} LookUp={row[fields['ORIG_FID']] : {field : row[fields[field]] for field in fields} for row in cursor}
fieldDict = {field: index for index, field in enumerate(cursor.fields)}
with arcpy.da.UpdateCursor(FEATURE CLASS,'*') as cursor: rowDict=dict(zip(cursor.fields,xrange(len(cursor.fields)+1)))) # zip fields to range of list length for row in cursor: row[rowDict[FIELD NAME]] = VALUE # use rowDict to find field list index cursor.updateRow(row)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.