python 3 remove spaces from string code example
Example 1: python delete white spaces
sentence = ' hello apple'
sentence.strip()
>>> 'hello apple'
Example 2: remove after and before space python
st = " a "
strip(st)
#Output : "a"
Example 3: how to remove spaces in string in python
sentence = ' hello apple '
sentence.strip()
>>> 'hello apple'
Example 4: strip whitespace python
>>> s.strip()
'Hello World From Pankaj \t\n\r\tHi There'