How to remove all line breaks from a string in Python

Removing all line breaks from a string results in the string being displayed in one line.

Solution for How to remove all line breaks from a string in Python : You can use str.replace() to remove all line breaks from a string Call str.replace(old, new) where old is “\n” and new is ” ” to replace the line breaks with a single space.


how-to-remove-all-line-breaks-from-a-string-in-python