programming-examples/python/Regular_Expression/Remove all whitespaces from a string.py
2019-11-15 12:59:38 +01:00

4 lines
136 B
Python

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