Question: I'm working on a python script to convert full uppercase addresses to Title Case. The issue I'm facing is that when I apply `.title()` to a string like *SOUTH 16TH STREET*, I get *South 16**Th** Street*. The desired conversion would be *South 16**th** Street*, where the abbreviation to the ordinal is lowercase.

*What is a simple way in python to accomplish this?* I was thinking about using some kind of regex.

Answer: 
Use this Regex-based solution:

```
import re
convert = lambda s: " ".join([x.lower() if re.match("^\d+(ST|ND|RD|TH)$", x) is not None else x.title() for x in s.split()])

```

Basically, I split the string and see for each word if it is an ordinal, then apply the appropriate action.
```
>>> str_='SOUTH 16TH STREET'
>>> ' '.join([i.title() if i.isalpha() else i.lower() for i in str_.split()])
'South 16th Street'

```