diff --git a/python/space_cleaner.py b/python/space_cleaner.py new file mode 100644 index 0000000..ef5e805 --- /dev/null +++ b/python/space_cleaner.py @@ -0,0 +1,23 @@ +"""Cleaning Spaces.""" +# ------------------------ Import libraries and functions --------------------- +import re + +# ---------------------------- function definition ---------------------------- + + +def space_cleaner(text: str) -> str: + """Cleans extra spaces. + + Args: + text (str): the text to be cleaned. + + Returns: + A text variable of after separating numbers. + + Examples: + >>> space_cleaner("hello to people ") + 'hello to people' + + """ + clear_text = re.sub(" ", " ", text).strip() + return clear_text