Code
Diff
  • def regex(s):
        import re
        return re.sub(r"[0-9]", "", s)
    
    def regex_plus(s):
        import re
        return re.sub(r"[0-9]+", "", s)
    
    def isnumeric(s):
        from itertools import filterfalse
        return "".join(filterfalse(str.isnumeric, s))
    
    def filter_digits(x):
        from itertools import filterfalse
        return "".join(filterfalse("0123456789".__contains__, x))
    
    def translate(s):
        return s.translate(str.maketrans("", "", "0123456789"))
    
    #def clean(s):
    #    newS = ''
    #    for i in s:
    #        if i not in '1234567890':
    #            newS += i
    #    return newS
    
  • 1313
    def filter_digits(x):
    
    1414
        from itertools import filterfalse
    
    1515
        return "".join(filterfalse("0123456789".__contains__, x))
    
    1616
    1717
    def translate(s):
    
    1818
        return s.translate(str.maketrans("", "", "0123456789"))
    
    19+
    20+
    #def clean(s):
    
    21+
    #    newS = ''
    
    22+
    #    for i in s:
    
    23+
    #        if i not in '1234567890':
    
    24+
    #            newS += i
    
    25+
    #    return newS