Split the Phone Numbers

  • + 0 comments

    Something something like this:

    import re
    
    regex = re.compile(r'(\d+)(?:-| )(\d+)(?:-| )(\d+)')
    
    n = int(input())
    for _ in range(n):
        m = regex.findall(input())[0]
        print('CountryCode={},LocalAreaCode={},Number={}'.format(*m))