title: Escape characters and raw string
body: <p>I wanto to replase <code>"&gt;"</code> with <code>"&amp;gt;"</code>. And the same for other symbols.</p>
  
  <pre><code>def escape_html(s):
      s = s.replace("&gt;", r"&amp;gt;")
      s = s.replace("&lt;", "&amp;lt;")
      s = s.replace('"', "&amp;quot;")
      s = s.replace('&amp;', "&amp;amp;")
      return s
  
  print escape_html("&gt;")
  </code></pre>
  
  <p>The result is <code>&amp;amp;gt;</code></p>
  
  <p>But I need <code>&amp;gt;</code></p>
  
  <p>Could you help me understand why raw string doesn't help me. And how should I write the code?</p>