Last active
November 2, 2016 09:27
-
-
Save natbusa/9dbeae216bd8e50d76a69ae214b913ce to your computer and use it in GitHub Desktop.
Separate trailing digits from the rest of the string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def trailing_digits(str): | |
m = re.search('^[0-9]*', str) | |
return (str[m.start():m.end()], str[m.end():]) | |
#> trailing_digits('1234 hollywood boulevard') | |
#> ('1234', ' hollywood boulevard') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment