>>> import re
>>> re.sub(' +', ' ', 'The quick brown fox')
'The quick brown fox'
More Related Contents:
- Removing contents within brackets in string [duplicate]
- How t extract last part of a text in python [duplicate]
- Regex not matching all the paranthesis substrings [duplicate]
- How to understand regular expression with python?
- How to extract numbers from a string in Python?
- How to correctly sort a string with a number inside? [duplicate]
- Split string on whitespace in Python [duplicate]
- Fast punctuation removal with pandas
- Remove all special characters, punctuation and spaces from string
- Python regex – r prefix
- How to input a regex in string.replace?
- Split a string at uppercase letters
- Python regex match OR operator
- Find longest repetitive sequence in a string
- How to extract an IP address from an HTML string?
- Extract a string between double quotes
- Regex for existence of some words whose order doesn’t matter
- Splitting a string with repeated characters into a list
- How would I get everything before a : in a string Python
- Python regex: splitting on pattern match that is an empty string
- Mass string replace in python?
- Remove duplicate chars using regex?
- How to remove symbols from a string with Python? [duplicate]
- Replace a string located between
- Remove Sub String by using Python
- FutureWarning: The default value of regex will change from True to False in a future version
- How do I verify that a string only contains letters, numbers, underscores and dashes? [duplicate]
- How to use str.contains() with multiple expressions in pandas dataframes
- Splitting a math expression string into tokens in Python
- Adding characters after a certain word in Python using regex