s = ' Hello World From Pankaj
Hi There '
>>> s.strip()
'Hello World From Pankaj
Hi There'
>>> s.replace(" ", "")
'HelloWorldFromPankaj
HiThere'
>>> " ".join(s.split())
'Hello World From Pankaj Hi There'
>>> import string
>>> s.translate({ord(c): None for c in string.whitespace})
'HelloWorldFromPankajHiThere'