Replace space with new line in Python
# Example string with spaces original_string = “Hello World Python Programming” # Replace spaces with newline characters new_string = original_string.replace(‘ ‘, ‘\n’) # Print the modified string print(new_string) Replace space with new line in Python Replacing spaces with newline characters in Python involves using the `str.replace()` method, which replaces all occurrences of a specified …