Standardize Mobile Number Using Decorators

  • + 0 comments
    from re import sub
    
    def wrapper(f):
        r = r"^(?:\+?91|0)??(\d{5})(\d{5})$"
        s = r"+91 \1 \2"
        
        def fun(li):
            return f([sub(r, s, i) for i in li])
        return fun