programming-examples/python/Regular_Expression/Remove multiple spaces in a string.py
2019-11-15 12:59:38 +01:00

4 lines
137 B
Python

import re
text1 = 'Python Exercises'
print("Original string:",text1)
print("Without extra spaces:",re.sub(' +',' ',text1))