things = arcpy.SearchCursor(yourFeatureClass, """ 'class' = "1" """,'','Data') for thing in things: mydata = thing.Data ...code to do something with the mydata value, such as writing it to a text file, etc..
rows = arcpy.SearchCursor(DBase_file) for row in rows: for field in desc.fields: rVal = row.getValue(field.name) arcpy.AddMessage("Field Name: " + field.Name + "Value: " + rVal)
I question your use of desc.fields...
Not sure that describe object is iterable. Can't you use the listFields function instead? Careful with case, could be ListFields, look up the topic of listing data.
fields = arcpy.ListFields(DBase_file) rows = arcpy.SearchCursor(DBase_file) for row in rows: for field in fields: rVal = row.getValue(field) arcpy.AddMessage("Field Name: " + field + "Value: " + str(rVal)) # is not always string
Hello,
I have a similar problem. I have a searchCursor that goes through a specific column in a table. On every row I need to compare the value from this row with the value on the next row and if they are equal do something and if they aren't equal do something else.
mxd = arcpy.mapping.MapDocument("CURRENT") table = arcpy.mapping.ListTableViews(mxd)[0] column = "name" cursor=arcpy.SearchCursor(table) for row in cursor: print(row.getValue(column))
I have this sample of code. It goes through all rows. But how can I compare the value from row[row] with the value from row[row+1]??
Thanks for any help.
I see you started a new question, which I would have suggested too. For others...