title: Why does putting Windows path into a variable does not replace a particular single slash with a double slash?
body: <p>Why does the second slash does not get replaced with double slash when I do the following in Python shell?:</p>
  
  <pre><code>&gt;&gt;&gt; p = 'M:\django\newenv\django_projects\mediaproject\mediaproject\media'
  &gt;&gt;&gt; p
  'M:\\django\newenv\\django_projects\\mediaproject\\mediaproject\\media'
  </code></pre>
  
  <p>I think this is causing an error I am getting when trying to <code>os.listdir(p)</code>:</p>
  
  <blockquote>
    <p>FileNotFoundError: [WinError 3] The system cannot find the path
    specified:
    'M:\\django\newenv\\django_projects\\mediaproject\\mediaproject\\media'</p>
  </blockquote>
  
  <p>Or is there any other cause of the error? The directory exists for sure and is copy-pasted from Windows file explorer.</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>I think this is because the second slash preceded the <code>n</code> character, so it gets treated as newline character. But how do I work around that (in real world I will not be typing the path manually)?</p>