AnsweredAssumed Answered

Strip numbers from certain fields

Question asked by Tonyalmeida on Oct 30, 2018
Latest reply on Oct 31, 2018 by Dan_Patterson

I need to strip numbers from certain fields. I have the following but it strips all number from the entire table.

Some of these fields have blanks and nulls.

 

import arcpy

arcpy.env.overwriteOutput = True

table = "C:/temp/EMS_Table"

field = ['Agency', 'fa', 'lz']
for field in [f.name for f in arcpy.Describe(table).fields if f.type == "String"]: 
    exp = "!{0}!.strip('0123456789.- ')" 
    arcpy.management.CalculateField(table, field, exp.format(field), "PYTHON")

Outcomes