I have a string variable. I want to obtain another string which contains the representation of the string variable content itself.
s = "a \n b"
I need to get a string containing the exact characters from above, including the escape character \
and the "
:
r = "\"a \\n b\""
Is there a function that can do that?
The output should be similar to repr("a \n b")
from Python:
This function makes an attempt to return a string that would yield an object with the same value when passed to eval()