python string exclude non alphabetical characters

Solutions on MaxInterview for python string exclude non alphabetical characters by the best coders in the world

showing results for - "python string exclude non alphabetical characters"
Lisa
16 May 2019
1import re
2
3regex = re.compile('[^a-zA-Z]')
4#First parameter is the replacement, second parameter is your input string
5regex.sub('', 'ab3d*E')
6#Out: 'abdE'
7
Lise
10 Sep 2018
1regex = re.compile('[,\.!?]') #etc.
2