I want the newline \\n to show up explicitly when printing a string retrieved from elsewhere. So if the string is \'abc\\ndef\' I don\'t want this to happen:
Another way that you can stop python using escape characters is to use a raw string like this:
>>> print(r"abc\ndef")
abc\ndef
or
>>> string = "abc\ndef"
>>> print (repr(string))
>>> 'abc\ndef'
the only proplem with using repr() is that it puts your string in single quotes, it can be handy if you want to use a quote