string replace blank space python code example
Example 1: python 3 replace all whitespace characters
>>> s = " \t foo \n bar "
>>> "".join(s.split())
'foobar'
Example 2: replace space with . pyhton
mystring.replace(" ", "_")
>>> s = " \t foo \n bar "
>>> "".join(s.split())
'foobar'
mystring.replace(" ", "_")