python string exclude non alphabetical characters code example
Example 1: python string exclude non alphabetical characters
regex = re.compile('[,\.!?]') #etc.
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'