python discard whitespace code example
Example 1: replacing spaces in a string python
mystring.replace(" ", "_")
Example 2: how to remove spaces in string in python
sentence = ' hello apple '
sentence.strip()
>>> 'hello apple'
mystring.replace(" ", "_")
sentence = ' hello apple '
sentence.strip()
>>> 'hello apple'