Created
June 26, 2010 05:43
-
-
Save axiak/453818 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from typedispatch import * | |
@dispatch(regexmulti(r'(\d{3})\D{0,2}(\d{3})\D?(\d{4})')) | |
def phone_numbers(phone_numbers): | |
for match in phone_numbers: | |
print '-'.join(match.groups()) | |
@dispatch() | |
def phone_numbers(text): | |
print "Could not find a phone number :-(" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment