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