how to replace all kinds of space with single whitespaces python code example
Example: python 3 replace all whitespace characters
>>> s = " \t foo \n bar "
>>> "".join(s.split())
'foobar'
>>> s = " \t foo \n bar "
>>> "".join(s.split())
'foobar'