I have an output coming out of a function. The output string has escape sequence (mainly \n).
I need to format this string so that escape sequence are implemented before I pass the formatted string to another function. The second function needs it in formatted way for it to do a text search with similar text.
Here's what I mean:
text = r'Your team should include the following \nboard-certified experts:\n \nA pulmonologist is a doctor who's an \nexpert of lung diseases.\n'
formatted_text = """Your team should include the following
board-certified experts:
A pulmonologist is a doctor who's an
expert of lung diseases."""
So as u see, if I do print(text), i will get the second string as print will implement the escape sequences. But I don't want to print. I want to format as second and store it another variable.
EDIT:
Pls run it in a notebook cell and DO NOT print(formatted_text). Run it just as a variable. If it doesn't remove escape sequence, it's not what I want.
Edit 2:
What I am looking for: