FieldNames = [f.Name for f in arcpy.ListFields(tbl)] # field name strings in a list Rows = arcpy.UpdateCursor(tbl) for Row in Rows: for f in FieldNames: print f, str(Row.GetValue(f))
Alternatively, the ListFields and ListIndexes functions can be used to create the same lists.
FieldObjects = arcpy.Describe(tbl).Fields FieldNames = [f.Name for f in FieldObjects] # field name strings in a list Rows = arcpy.UpdateCursor(tbl) for Row in Rows: for f in FieldNames: print f, str(Row.GetValue(f)) print
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.