title: Replace '\' character in python
body: <p>I don't know why i can't find it, but i wanted to replace the special character <code>'\'</code> in python.</p>
  
  <p>I have a String within i have <code>'\'</code> characters but i confident find the solution, to replace it with '-'.
  This is what happening while i am trying to replace,</p>
  
  <pre><code>&gt;&gt;&gt; x = 'hello\world'
  &gt;&gt;&gt; x
  'hello\\world'
  &gt;&gt;&gt; x.replace('\', '-')
    File "&lt;stdin&gt;", line 1
      x.replace('\', '-')
  SyntaxError: EOL while scanning string literal
  </code></pre>
  
  <p><strong>EDIT:</strong>
  Do try this it in the eclipse IDLE</p>
  
  <pre><code>x = 'hello\world'
  print x
  x.replace('\\', '-')
  print x
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>hello\world
  hello\world
  </code></pre>