remove character from string python ^a-z code example
Example 1: python remove all except numbers
>>> import re
>>> re.sub('\D', '', 'aas30dsa20')
'3020'
Example 2: python remove non letters from string
def nospecial(text):
import re
text = re.sub("[^a-zA-Z0-9]+", "",text)
return text