I have a feature class with some fields that i would like to remove the numeric characters from but just the numbers and only from the fist 3 characters of the attribute i need to able to keep the # and numbers at the end.
The fields look like this
|FireDist||699 HWY #4||763 School #132|
|710 Rural Fire||690 HWY #1||762 School #131|
|720 Rural Fire||693 HWY #2||770 School #139|
|NOT in First Dist||696 HWY #3||765 School #134|
I am not sure who to use arcpy to only look at the first 3 characters and if they are numeric to strip them and to strip it from all 3 fields at once. I would be grateful for some help.
Solved! Go to Solution.
In addition to using built-in string methods, there is a fairly straightforward regular expression approach:
>>> import re >>> hwy = "699 HWY #4" >>> pattern = re.compile(r"[^\W\d_]", re.UNICODE) >>> hwy[pattern.search(hwy).start():] 'HWY #4' >>>