-1

I'm trying to seperate a list of mailing addresses and names that are intertwined in a single column due to poor formating. I initially wanted to grab all of the entries that are alphanumeric so I can separate them however I'm having trouble with the .isalnum() function. My string is a mailing address so I can't remove all of the white space as it would ruin the formatting.

'123 main st'.isalnum()

doesn't work because of the white space and I can't quite figure out how to effectively check if this is correct.

1 Answers1

0

Possible duplicate: Check if a string contains a number.

def has_numbers(inputString):
    return any(char.isdigit() for char in inputString)

has_numbers("123 main st")
True