Solved! Go to Solution.
def prefix(): rows = arcpy.UpdateCursor(table) for row in rows: if len(row.FullAddr.split(" ")[0]) == 1: row.Prefix = row.FullAddr[0] rows.updateRow(row) del row, rows def suffix(): rows = arcpy.UpdateCursor(table) for row in rows: row.Suffix = row.FullAddr.split(" ")[-1] rows.updateRow(row) del row, rows def street(): rows = arcpy.UpdateCursor(table) for row in rows: if len(row.FullAddr.split(" ")[0]) == 1: row.Street = ' '.join(row.FullAddr.split(" ")[1:-1]) rows.updateRow(row) else: row.Street = ' '.join(row.FullAddr.split(" ")[0:-1]) rows.updateRow(row) del rows, row prefix() suffix() street()
if len(!Field!.split(" ")[0]) == 1: you have a one letter prefix
def prefix(): rows = arcpy.UpdateCursor(table) for row in rows: if len(row.FullAddr.split(" ")[0]) == 1: row.Prefix = row.FullAddr[0] rows.updateRow(row) del row, rows def suffix(): rows = arcpy.UpdateCursor(table) for row in rows: row.Suffix = row.FullAddr.split(" ")[-1] rows.updateRow(row) del row, rows def street(): rows = arcpy.UpdateCursor(table) for row in rows: if len(row.FullAddr.split(" ")[0]) == 1: row.Street = ' '.join(row.FullAddr.split(" ")[1:-1]) rows.updateRow(row) else: row.Street = ' '.join(row.FullAddr.split(" ")[0:-1]) rows.updateRow(row) del rows, row prefix() suffix() street()