Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python remove consecutive spaces

# credit to the Stack Overflow user in the source link

import re
re.sub(' +', ' ', 'The     quick brown    fox')
>>> 'The quick brown fox'
Comment

PREVIOUS NEXT
Code Example
Python :: run multiple function with multiprocessing python 
Python :: python how to check if a functions been called 
Python :: how to delete a file in python 
Python :: python fillna with mode 
Python :: short form of if statement in python 
Python :: loop through python object 
Python :: neuronal network exemple python 
Python :: python how to create dict from dataframe based on 2 columns 
Python :: compress tarfile python 
Python :: python file reading 
Python :: how to store in parquet format using pandas 
Python :: one-line for loop python 
Python :: python get average of list 
Python :: wordle python 
Python :: __str__() 
Python :: rotate image in pygame 
Python :: isnull().mean() python 
Python :: how to calculate sum of a list in python 
Python :: how to download instagram profile picture with the help of python 
Python :: Simple Scatter Plot in matplotlib 
Python :: boto3 delete bucket object 
Python :: read from text file and append in list 
Python :: LoginRequiredMixin 
Python :: dataframe create 
Python :: handle errors in flask 
Python :: shuffle list 
Python :: python remove first element from list 
Python :: iterate through characters in a string python 
Python :: conda environment 
Python :: sympy function definition 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =