replace more than one space with one space python code example Example: replace multiple spaces with single space python ' '.join(mystring.split())