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