Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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'
Comment

python string exclude non alphabetical characters

regex = re.compile('[,.!?]') #etc.
Comment

PREVIOUS NEXT
Code Example
Python :: plt change legend coordinates 
Python :: how to move columns in a dataframen in python 
Python :: python discord input 
Python :: how to add contents of one dict to another in python 
Python :: argparse multiple arguments as list 
Python :: python every other goes to a list 
Python :: tkinter draw squaer 
Python :: split multiple times 
Python :: django delete session 
Python :: python regex remove digits from string 
Python :: django get user model funciton 
Python :: pd max rows set option 
Python :: foreign key constraint failed django 
Python :: make beep python 
Python :: python subtract one list from another 
Python :: registering static files in jango 
Python :: plt.figure resize 
Python :: delete turtle 
Python :: pandas groupby get all but first row 
Python :: how to download file in python 
Python :: pandas unnamed zero 
Python :: pycharm remove not in use imports 
Python :: knn classifier python example 
Python :: pyautogui pause in python 
Python :: rename columns in datarame pandas 
Python :: spacex 
Python :: np.concatenate 
Python :: Python - Drop row if two columns are NaN 
Python :: roll longitude about zero 
Python :: pandas to pickle 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =