Chrome Extension

Python - regex , remove all single characters,replace all single chars,char

# remove all single characters
# replace all single chars,char
import re

text = "That is a           test for removing                         multiple spaces"

document = re.sub(r's+[a-zA-Z]s+', ' ', text)

print(document)
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Output
That is test for removing multiple spaces

Remove all single characters with Space that we specify in regex expression

Was this helpful?
0 Comments
Join Devsheet Ask a Question