I am trying to remove extra spaces from values in a field programatically using a python script. This is the script I'm using:
field1 = "FULLST_NAME" calc1 = "s.join(!" + field1 + "!.split())" s = "\' \'" arcpy.CalculateField_management(c_lines, field1, calc1, "PYTHON_9.3")
The expression used in calc1 works fine when I manually input it in the field calculator, i.e.
" S STATE ROUTE " is changed to "S STATE ROUTE"
However, when executing the script, it outputs:
"S' 'STATE' 'ROUTE"
with the ' ' between each string. I'm guessing there is some syntax I'm missing when storing the calculation in the variable and using it as a parameter in CalculateField_management(). How can I fix this?