If STREETNM value are blank or _ then I want to replace them with the value of ST_DESIG. My code below returned the code value of ST_DESIG but not the description.
How can I get the description value of the ST_DESIG. For example, "Divided Major Highway - Class II" NOT 1.
import arcpy
Streets_Centerlines = r"G:\xStreetNew\Test.gdb\Streets_Centerlines"
expression = "replace(!STREETNM!)"
codeblock = """
def replace(STREETNM,ST_DESIG):
if STREETNM.lstrip().rstrip() == '' or STREETNM.lstrip().rstrip() == '_':
return ST_DESIG
else:
return STREETNM
"""
arcpy.CalculateField_management(Streets_Centerlines, "STREETNM", "replace(!STREETNM!,!ST_DESIG!)", "PYTHON", codeblock)
No comments:
Post a Comment