I would like to update a field with new values. With the code below it assigns the value '2' to all the rows and not just if the field == 2. But by 'print i' and 'print "it is 2"' everything looks correct. Any ideas?
field = "field" field2List =  rows = arcpy.SearchCursor(input_layer) for my_row in rows: field2List.append(my_row.getValue(field)) cursor = arcpy.UpdateCursor(input_layer) for row in cursor: for i in field2List: print i if i == 2: print "it is 2" row.setValue(my_field,2) cursor.updateRow(row) else: print "not 2"