I have table with a field containing attribute names in another language (oldname1, oldname2,...). I want to create a new field in which I can add (with field calculator) the translated name of each attribute in my language (newname1,newname1,...).
I thought the cursor would be the best way to realize this. The original field is called fieldA and the new field fieldB
I tried with a cursor but my script isn't working. The error is given for line "if row in 'fieldA'= 'oldname1'
myTable = ":\\path to table" cursor = arcpy.da.SearchCursor(myTable, ['fieldA', 'fieldB']) for row in cursor: if row in 'fieldA'= "oldname" arcpy.CalculateField_management(myTable, 'fieldB',"newname1") elif... .....
I tried to add cursors for each field as variable before the loop:
fieldA= arcpy.da.SearchCursor(myTable, ['fieldA']) fieldB= arcpy.da.SearchCursor(myTable, ['fieldB'])
But it is not helping. I also try to write ['fieldA'] instead of 'fieldA'
Can I create variables for each field and use it in the cursor? or do you have an idea of how I could fix this?