python strip string spaces code example
Example 1: python remove spaces
string=' t e s t '
print(string.replace(' ',''))
Example 2: python remove spaces from string
>>> " ".join(s.split())
'Hello World From Pankaj Hi There'
string=' t e s t '
print(string.replace(' ',''))
>>> " ".join(s.split())
'Hello World From Pankaj Hi There'