I am having an issue replacing an ! as a character from my record. I want to replace a ! as a [blank]. I tried using this statement, but it does not work:
arcpy.CalculateField_management(CISAddressSDEFL, "NEIGHBOUR", "!NEIGHBOUR!.replace(\"!\", \"\")", "PYTHON", "")
All other special characters work, but not the !. Any ideas on how to perform a replace?
Solved! Go to Solution.
I figured it out, I basically concerted the ! to an ASCI code and it worked. Here is my syntax:
# ! Screening
arcpy.SelectLayerByAttribute_management(CISAddressSDEFL, "NEW_SELECTION", "NEIGHBOUR LIKE '%!%'")
explanationPointChar = chr(33)
arcpy.CalculateField_management(CISAddressSDEFL, "NEIGHBOUR", "!NEIGHBOUR!.replace(explanationPointChar, \"\")", "PYTHON", "")
I figured it out, I basically concerted the ! to an ASCI code and it worked. Here is my syntax:
# ! Screening
arcpy.SelectLayerByAttribute_management(CISAddressSDEFL, "NEW_SELECTION", "NEIGHBOUR LIKE '%!%'")
explanationPointChar = chr(33)
arcpy.CalculateField_management(CISAddressSDEFL, "NEIGHBOUR", "!NEIGHBOUR!.replace(explanationPointChar, \"\")", "PYTHON", "")