How is this weird behaviour of escaping special characters explained?
<p>Just for fun, I wrote this simple function to reverse a string in Python:</p>

<pre><code>def reverseString(s):
    ret = ""
    for c in s:
        ret = c + ret
    return ret
</code></pre>

<p>Now, if I pass in the following two strings, I get interesting results.</p>

<pre><code>print reverseString("Pla\net")
print reverseString("Plan\et")
</code></pre>

<p>The output of this is </p>

<pre><code>te
alP
te\nalP
</code></pre>

<p>My question is: Why does the special character <code>\n</code> get translated into a new line when passed into the function, but not when the function parses it together by reversing <code>n\</code>?  Also, how could I stop the function from parsing <code>\n</code> and instead return <code>n\</code>?</p>
