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
- 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"))- return s.translate(str.maketrans("", "", "0123456789"))
- #def clean(s):
- # newS = ''
- # for i in s:
- # if i not in '1234567890':
- # newS += i
- # return newS