Here is what I have
import arcpy
inputFC = arcpy.GetParameterAsText (0) #Feature Class
inputField = arcpy.GetParameterAsText (1) #Field to manipulate
inputChar = arcpy.GetParameterAsText (2) #The character(s) I wish to replace
replChar = arcpy.GetParameterAsText (3) #The character(s) I wish to replace them with
arcpy.CalculateField_management(inputFC, inputField, !inputField!.replace(inputChar, replChar), "PYTHON_9.3")
I am trying to use the "CalculateField_management
" tool with a variable instead of a direct field for the 3rd input like I am with the first 2, but I can't seem to fit it in with the expression. I want it to take the value of the existing string and replace the characters I desire. How is the expression supposed to be written?
I have tried a variety of ways and can't figure it out.
For example: !inputField!.replace, '"!inputField!'".replace, inputField.replace, '"inputField"'.replace
, etc.