Skip to content

Instantly share code, notes, and snippets.

@mrinal-scio
Created February 3, 2023 08:00
Embed
What would you like to do?
def clean_address(s):
s1 = re.sub(r'^[A-Z0-9]{4}-', '', s) # T-Mobile specific
s2 = re.sub(r'[^\s,a-zA-Z]', ' ', s1) # drop all numbers and non-comma punct
s3 = re.sub('Remote', '', s2) # drop "Remote"
s4 = re.sub(r'\s+', ' ', s3) # normalize whitespace
return s4.lstrip().rstrip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment