You are viewing a single comment's thread. Return to all comments →
I know this isn't strictly a Python problem, however, it is a good simple problem to test or remind yourself of how to use Python decorators.
Without revealing the RegEx I used, the following is what I did to decorate the basic PhoneNumber() function, which simply extracts the groups.
def Wrapper(func): def Decorate(Num): Num = func(Num) return "CountryCode=%s,LocalAreaCode=%s,Number=%s" % Num return Decorate @Wrapper def PhoneNumber(Num): return re.match(RegEx,Num).groups(); for _ in range(int(input())): print(PhoneNumber(input().strip()))
Seems like cookies are disabled on this browser, please enable them to open this website
Split the Phone Numbers
You are viewing a single comment's thread. Return to all comments →
I know this isn't strictly a Python problem, however, it is a good simple problem to test or remind yourself of how to use Python decorators.
Without revealing the RegEx I used, the following is what I did to decorate the basic PhoneNumber() function, which simply extracts the groups.