title: (Python 2.7) Regex Replace with similar character in replacement string as in pattern
body: <pre><code>import re
  pattern = re.compile(r"/")
  a = "a/b"
  </code></pre>
  
  <p>I tried</p>
  
  <pre><code>re.sub(pattern, '\/', a) 
  #(also, a.replace('/', '\/'))
  #output
  a\\/b
  </code></pre>
  
  <p>What I want is </p>
  
  <pre><code>a\/b
  </code></pre>