AnsweredAssumed Answered

Replace Stand Alone Script

Question asked by hnavarro23 on Jul 5, 2019
Latest reply on Jul 5, 2019 by Dan_Patterson

I am trying to remove prefixes from a field, eg. SV192W001 to 192W001.  I run the following code and it runs without any errors but when I look at the field none of the prefixes are removed/replaced.  Any help appreciated.  Thanks in advance.

 

import arcpy
from arcpy import env

# Set workspace
arcpy.env.workspace = "B:/Projects/Duplicate Assets/Duplicate.gdb/dwSystemValve"

fieldName = "ValveID"

# Remove prefixes from ValveID
print("Removing prefixes")
fieldName.replace("SV","")
fieldName.replace("HV","")
fieldName.replace("SR","")

print("Done")

Outcomes