python strip all non alphabet code example
Example 1: python remove non letters from string
def nospecial(text):
import re
text = re.sub("[^a-zA-Z0-9]+", "",text)
return text
Example 2: python string exclude non alphabetical characters
import re
regex = re.compile('[^a-zA-Z]')
#First parameter is the replacement, second parameter is your input string
regex.sub('', 'ab3d*E')
#Out: 'abdE'