I would like to point out that, depending on how that triple-quoted string is being used, you could avoid the issue entirely.
In Python triple-quoted strings, you can put a backslash ("\
") at the end of a line to ignore the line break. In other words, you can use it to put a line break at that spot in your code without making a line break in your string.
For example:
"""line 1 \
line 2 \
line 3"""
will actually become
line 1 line 2 line 3
if printed or written to some file or other output.
Using it this way can eliminate any need for a function to replace the line breaks, making your code clearer and cleaner.
EDIT:
If you're using backslash line continuations like this, you can also use simple single-quoted strings the same way;
"line 1 \
line 2 \
line 3"
is also equivalent to
line 1 line 2 line 3