replace all whitespace with single space python code example Example: reolace double space ti single space in python' ' '.join(mystring.split())