title: replacing string from '\' into '/' Python
body: <p>I've been strugling with some code where i need to change simple <code>\</code> into <code>/</code> in Python. Its a path of file- Python doesn't read path of file in Windows'es way, so i simply want to change Windows path for Python to read file correctly.</p>
  <p>I want to parse some text from game to count statistics. Im Doing it this way:</p>
  <pre><code>import re
  
  pathNumbers = &quot;D:\Gry\Tibia\packages\TibiaExternal\log\test server.txt&quot;
  pathNumbers = re.sub(r&quot;\\&quot;, r&quot;/&quot;,pathNumbers)
  
  fileNumbers = open (pathNumbers, &quot;r&quot;)
  
  print(fileNumbers.readline())
  fileNumbers.close()
  </code></pre>
  <p>But the Error i get back is</p>
  <p><code>----&gt; 6 fileNumbers = open (pathNumbers, &quot;r&quot;) OSError: [Errno 22] Invalid argument: 'D:/Gry/Tibia/packages/TibiaExternal\test server.txt'</code></p>
  <p>And the problem is, that function <code>re.sub()</code> and <code>.replace()</code>, give the same result- almost full path is replaced, but last char to change always stays untouched.</p>
  <p>Do you have any solution for this, because it seems like changing those chars are for python a sensitive point.</p>