I want to fill a new field in a shapefile using arcpy. I have differents values so I am using for iterator to run all rows. But when I run the code all rows are filling with the latest row value. The code is:
#-----------------------------
camp= "GROUP"
a= parameters[0].valueAsText
arcpy.AddField_management(a, camp, "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
#-----------------------------
cursor = arcpy.SearchCursor(a)
for row in cursor:
n = row.getValue("CODE2012")
arcpy.CalculateField_management(a, camp, n,"PYTHON_9.3",code_block="")`
I obtain this attribute table: