erase spaces from string python code example
Example 1: how to remove spaces in string in python
sentence = ' hello apple '
sentence.strip()
>>> 'hello apple'
Example 2: python remove space from end of string
>>> " xyz ".rstrip()
' xyz'
Example 3: strip whitespace python
>>> s.strip()
'Hello World From Pankaj \t\n\r\tHi There'