title: error: bad escape (end of pattern) at position 0 while trying to replace to backslah
body: <p>I need to replace single backslash in my string.
  I'm trying to perform '\' but it gives with me double backslash.
  When i'm performing '\' it throw error  bad escape (end of pattern) at position 0</p>
  
  <pre><code>string = 'abrakadabra'
  string.replace('a','\\')
  #or
  re.sub('a','\\','abrakadabra')
  
  In [47]: string.replace('a','\'')
  Out[47]: "'br'k'd'br'"
  
  In [48]: string.replace('a','\')
   File "&lt;ipython-input-48-e884682860ae&gt;", line 1
  string.replace('a','\')
                         ^
  </code></pre>
  
  <p>SyntaxError: EOL while scanning string literal</p>
  
  <pre><code>In [49]: string.replace('a','\\')
  Out[49]: '\\br\\k\\d\\br\\'
  
  In [50]: 
  </code></pre>
  
  <p>expecting for result:
  \br\k\d\br\</p>