title: Cleaning escapes on a user-entered string
body: <p>I have a user that can enter in text that a program will print after parsing. That is, the user can enter in something like:</p>
  <pre><code>&quot;Print me\nAnd on a newline now&quot;
  </code></pre>
  <p>And it should print as:</p>
  <pre><code>Print me
  And on a newline now
  </code></pre>
  <p>The string I have now looks like <code>OK\n</code> when I print it and <code>OK\\n</code> when I do <code>repr()</code> on it. I'm having some difficulty converting this to properly print the newline. The only thing that seems to work now is to manually go through each possible entry and do something like:</p>
  <pre><code>val = val.replace('\\n', '\n'))
  # or, what if they wanted a beep?
  # similar to print('\a')
  </code></pre>
  <p>Is there a better way to do this?</p>