I'm trying to strip the last character in a string if when the string is split by spaces the last element has a length of 1. I then want to put that letter in front of the rest of the other elements.
So, if I had a value of 1st Street W, I would like to convert it to W 1st Street
I'm using this code in the "Pre-Logic Script Code" box in ArcMap field calculator:
def getPrefix(Street_Name): if len(!Street_Name!.split(" ")[-1])==1: !StreetName2! = !Street_Name!.split(" ")[-1] + " " + !Street_Name!.split(" ")[0:-1]
And in the box below that:
I'm getting an error 000989, syntax indention error, but I have everything at two spaces in cascading from calling the function. Pretty sure that's the ESRI specification for the field calculator.